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
2
votes
1 answer

How to add custom rest APi function in Sylius?

I'm new at Sylius I would like to extend the Sylius rest api to add some actions like getting a list of products by taxon/variant/option ... is there any documentation that helps Thanks
Abde
  • 41
  • 4
2
votes
0 answers

symfony 2.7.13 JMS Serializer customization of 3rd-party bundles query problems

I try to customize my jms serializer config and copy the xml config of SonataMediaBundle to my local config. The requests are in a Controller that extends FOSRestBundle in a Symfony 2.7.13 application with sonata-project bundles. My current issue…
user1516851
2
votes
2 answers

FOSRestBundle AccessDeniedException redirects to login page

I use FOSRestBundle 2.1 with Symfony 3.0 for creating a RESTful JSON API, and I stuck with handling AccessDenied exception. It redirects to the login page although I configured it to show a 403 error. Controller: /** * @RouteResource("User") …
Alexey Kosov
  • 3,010
  • 2
  • 23
  • 32
2
votes
1 answer

FOSRestBundle & invalid form CRF token

I'm trying to implement FOSRestBundle and Symfony forms. I have found this tutorial but I have problem with this part private function processForm(PageInterface $page, array $parameters, $method = "PUT") { $form = $this->formFactory->create(new…
breq
  • 24,412
  • 26
  • 65
  • 106
2
votes
1 answer

REST service in Symfony2, with a dot in a parameter (FOSRestBundle)

I have a REST API done in Symfony2 with FOSRestBundle Globally, it works but.. I have a route like this /api/mymethod/{param} with the implicit .{_format} When my param has no dot inside, .../mymethod/toto.json it works. But if it has a dot, I'm…
2
votes
2 answers

FOSRestBundle - response data manipulation

I'm using FOSRestBundle. I want to return user info but with less data information... How to do this? Here is my current response { "id": 1, "user": { "id": 1, "username": "qqqq", "username_canonical": "qqqq", …
breq
  • 24,412
  • 26
  • 65
  • 106
2
votes
1 answer

JMS @Discriminator filed doesn't appear if specific group is serializing

I'm using Symfony 2.8, FOSRestBundle and JMSSerializerBundle. Problem Discriminator field type of Document entity doesn't apear in serialized model when I serialize specific group ("api" group in folowing example) of entity Citizen. Doctrine…
2
votes
1 answer

FOSRest per bundle. How to configure?

I'm new to symfony and I just started to build a pilot project for learning purposes. Using symfony 3 and having an app I would like to build with FOSRest a JSON based API and another separate bundler should provide the Backend on user…
fefe
  • 8,755
  • 27
  • 104
  • 180
2
votes
0 answers

Merge ParamConverter and BodyConverter objects on FOSRestBundle

I'm using the param converter to get object from url and body converter to get object form body. This perfectly works for GET and POST methods, but I have to do it with a tricky way for an update (PUT): /** * @param PowerDNSDomain …
Soullivaneuh
  • 3,553
  • 3
  • 37
  • 71
2
votes
0 answers

How to use CollectionType with FosRestBundle

I'm building an API with the FOSRestBundle and I'm trying to add existing Employee entities to an existing Report entity. But my form validation keeps throwing an error: This form should not contain extra fields Adding 'allow_add' => true to the…
jsprds
  • 67
  • 2
  • 9
2
votes
1 answer

Symfony FosRestBundle - Hyphenated rest routes

I'm currently learning the basics of the FosRestBundle in a basic Symfony 3 project and am looking at creating a hyphenated REST route. An example of a simple route I currently have, where GET /coffees hits CoffeeController::getCoffeesAction() as…
Chris Brown
  • 4,445
  • 3
  • 28
  • 36
2
votes
1 answer

Symfony and Angular application

I have SF2 application and AngularJS client. When I create some item symfony returns HTTP 201 status, which means item is created. And... I want to know ID of this item, or better route to this item. So when I create something I want to return HTTP…
Kamil P
  • 782
  • 1
  • 12
  • 29
2
votes
0 answers

Nelmio API doc: Documentation says my json objects are arrays, how to fix?

I'm using Nelmio API docs to generate the documentation for my REST api using FOSRestBundle and JMSSerializer. The docs generated say my json objects are actually arrays. How do I make the documentation say my objects are objects? I know under the…
2
votes
2 answers

Sysmfony REST API hash id of entities

I'm building a multitenancy backend using Symfony 2.7.9 with FOSRestBundle and JMSSerializerBundle. When returning objects over the API, I'd like to hash all the id's of the returned objects, so instead of returning { id: 5 } it should become…
bac
  • 226
  • 3
  • 10
2
votes
1 answer

Returning 400 BAD REQUEST on each POST - fosrestbundle, Symfony3

I am using fosrestbundle on Symfony3 to create a server side web-api. fos_rest configuration of app/config/config.yml fos_rest: param_fetcher_listener: true body_listener: true format_listener: enabled: true …
Sujit
  • 790
  • 1
  • 13
  • 27