Questions tagged [fosrestbundle]

A Symfony 2 plugin by FriendsOfSymfony (FOS) which provides various tools to rapidly develop RESTful API's with Symfony 2.

A Symfony 2 bundle by FriendsOfSymfony (FOS) which provides various tools to rapidly developer RESTful API's with Symfony 2.

Its features include:

  • A View layer to enable output and format agnostic Controllers
  • A custom route loader to generate url's following REST conventions
  • Accept header format negotiation including handling for custom mime types
  • RESTful decoding of HTTP request body and Accept headers
  • Exception controller for sending appropriate HTTP status codes

Links:

803 questions
7
votes
2 answers

FOSRestBundle configuration of exceptions messages in prod environment

I'm struggling with a problem linked to the FOSRestBundle (version 0.13.*) I have some REST api that throws some exceptions, nothing unusual I guess. But, despite the specific configuration I made to allow exceptions messages to be formatted in the…
Guillaume PETIT
  • 73
  • 1
  • 2
  • 5
7
votes
2 answers

Creating linked entities in REST api in Symfony

What is the proper way to create entity which will be linked to other ones? I can't find any source about how it should be done or how it is done in Symfony with FOSRestBundle bundle. Background: Lets have entity Car with entities of Wheel. How to…
Keo
  • 1,143
  • 8
  • 19
7
votes
1 answer

Do not work ParamConverter with "fos_rest.request_body" converter

I'm trying to use FOSRestBundle's request body converter but my current implementation doesn't seem to work. I am using Symfony2, Propel, AngularJS (it sends data to server) What am i doing wrong? config.yml: fos_rest: routing_loader: …
Dmitry Skryabin
  • 1,584
  • 2
  • 10
  • 15
7
votes
1 answer

FOSRestBundle - Allow only json + xml and default to json if no other requested

Could someone show me a reference configuration of FOSRestBundle that will only allow json + xml and willd default to json if "Accepted" or "Content-Type" has not been set. My goal is to drop the templates html support and all other unnecessary…
n00b
  • 16,088
  • 21
  • 56
  • 72
7
votes
1 answer

How can I track API usage in Symfony2?

I'm building a RESTful service in Symfony2, using the FOSRestBundle. I can track page usage in web clients using Google Analytics. However, this is is obviously not going to work for requests by non-HTML clients. Before I embark on installing Redis,…
Dan Blows
  • 20,846
  • 10
  • 65
  • 96
6
votes
1 answer

Symfony Serializer issue - NotNormalizableValueException

I have an issue when I'm using the serializer with FOSRestBundle in Symfony 4.1 I have the following error message : Could not normalize object of type App\Entity\Youp, no supporting normalizer found. …
edwix
  • 73
  • 1
  • 5
6
votes
1 answer

JMS unserialize to-many relation does not remove with orphanremoval

I have a Symfony rest api build with fos restbundle and I'm deserializing a json PUT request in order to update a doctrine entity with a to-many relation. However, the to-many child objects which are configured with orphanremoval=true does not get…
6
votes
2 answers

Serialize POST request body into array with FOSRestBundle

I am trying to make a Rest web service using Symfony 3 and FOSRestBundle. I come from a Spring + Jackson background so i'm trying to make it so that you can pass objects to controllers as request body that become function parameters and return…
valepu
  • 3,136
  • 7
  • 36
  • 67
6
votes
2 answers

JMSSerializerBundle Show blank value instead of null value

We are using Symfony2 FOSRestBundle with JMSSerializerBundle for developing REST APIs to be consumed by mobile developers. The API response in JSON format returns 'null' as value of properties wherever applicable, which is generating an exception…
Jeet
  • 1,587
  • 1
  • 9
  • 22
6
votes
4 answers

Dynamic serialization groups on FOS REST bundle

I'm currently using FOSRESTBundle with JMSSerialize to make a RESTFull API (of course). My project is an extranet for customers and administrators. In this way, I have to disable some field from being viewed by customer, only visible for…
Soullivaneuh
  • 3,553
  • 3
  • 37
  • 71
6
votes
2 answers

FOSRestBundle: partial response in function of attributes asked in the request

Context I found a lot of questions about partial API response with FOSRest and all the answers are based on the JMS serializer options (exlude, include, groups, etc). It works fine but I try to achieve something less "static". Let's say I have a…
GG.
  • 21,083
  • 14
  • 84
  • 130
6
votes
2 answers

FOSRestBundle camel keys normalizer not working

This is my config file: // app/config/config.yml fos_rest: body_listener: array_normalizer: fos_rest.normalizer.camel_keys I am using the latest version of FOSRestBundle: // composer.json "friendsofsymfony/rest-bundle":…
Sukhrob
  • 901
  • 4
  • 12
  • 34
6
votes
2 answers

FOS\RestBundle, "Unrecognized options" on Symfony2

I've a problem with Symfony2 creating Rest API and using FOS\RestBundle When I try to generate a database or an entity… Whatever I try to generate, an error occurs. root@symfonyRest:/var/www/Symfony# php5 app/console doctrine:database:create …
Kevin Machado
  • 4,141
  • 3
  • 29
  • 54
6
votes
2 answers

The controller must return a response, array given

I am trying to follow Will Durand's tutorial on how to set up a good REST API with Symfony2. However I am failing in the very beginning as I get this error: The controller must return a response (Array(welcome => Welcome to my API)…
sprain
  • 7,552
  • 6
  • 35
  • 49
6
votes
2 answers

JMSSerializerBundle complex generated value

I need implement RESTful API for my site on symfony 2, so i use FOSRestBundle + JMSSerializerBundle I have such serializer yml for my entity: Acme\DemoBundle\Entity\Product: exclusion_policy: ALL accessor_order: custom …
striker
  • 1,253
  • 3
  • 15
  • 25
1 2
3
53 54