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
0
votes
0 answers

How to share Symfony2 FOSRestBundle routes with client?

I'm working on a RESTful API with FOSRestBundle, and I was thinking along the lines of creating a dictionary of API urls for clients. It just feels like a waste of time and unnecessary complexity to involve just-in-time twig/path helper calls once…
tishma
  • 1,855
  • 1
  • 21
  • 43
0
votes
1 answer

How to reduce the error message in FOSRestBundle?

I am using FOSRestBundle. I am using a GET request and I am expecting an 404 error message, but it is very long. Here is the definition of the action() method: /** * @Rest\View * @Rest\Get("/api/test/{id}", * requirements={"id" = "\d+"}, * …
Amine Jallouli
  • 3,919
  • 8
  • 36
  • 73
0
votes
2 answers

Symfomy2 manual route definitions with FOSRestBundle

I am now using the FOSRestBundle in order to build a REST API within my Symfony application. The idea for now is to list some locations(hotels, restaurants...), I managed to configure the automatic routes with FOSRestBundle like: /api/locations ,…
Tíbó
  • 1,188
  • 13
  • 28
0
votes
2 answers

Paramconverter with FOSRestbundle

I am trying to convert in a route the username to a user. Unfortunately the paramconverter searches always for the id. I have already tried it with several settings, my current settings look like this: /* * @ParamConverter("username",…
m0c
  • 2,180
  • 26
  • 45
0
votes
1 answer

Doctrine2 ORM Ignore relations in Merge

I'm implementing a REST Api with FOSRestBundle and I have encountered a problem with the modification of existing entity (PUT) I have a class Student with has a ManyToOne relation /** * @JMS\MaxDepth(2) * @ORM\ManyToOne(targetEntity="ClassRoom",…
Nodens
  • 354
  • 1
  • 3
  • 11
0
votes
1 answer

Symfony 2 - keeping the code DRY - FOSRestBundle

I'm currently using Symfony2 to create (and learn how to) a REST API. I'm using FOSRestBundle and i've created an "ApiControllerBase.php" with the following :
Arnaud Janssens
  • 150
  • 1
  • 12
0
votes
1 answer

Symfony2 FOSRestBundle: Which class to include for codes like HTTP_NO_CONTENT

I wanna throw an HTTP_NO_CONTENT, but symfony tells me that ClassNotFoundException: Attempted to load class "Codes" from namespace "FOS\Rest\Util". Do you need to "use" it from another namespace? I actually did use FOS\RestBundle\Util\Codes; in my…
Fabian
  • 1,806
  • 5
  • 25
  • 40
0
votes
1 answer

Symfony2 FOSRestBundle: How to create custom GET-method

I have configured FOSRestBundle like following: fos_rest: param_fetcher_listener: true body_listener: true format_listener: true view: view_response_listener: 'force' routing_loader: default_format: json include_format:…
Fabian
  • 1,806
  • 5
  • 25
  • 40
0
votes
1 answer

Symfony 2 - FOSRestBundle - Call api method from another controller

I'm trying to call a method of my API but I get this exception : FatalErrorException: Error: Call to undefined method Project\Bundle\ApiBundle\Controller\UserController::userCreate()…
manonthemoon
  • 2,611
  • 8
  • 26
  • 40
0
votes
1 answer

Cannot redeclare class caused by restroute

I am basically following this tutorial: http://welcometothebundle.com/symfony2-rest-api-the-best-2013-way/ I already have created my first controller but as soon as I start adding the route: routing.yml strego_user_controller: resource:…
m0c
  • 2,180
  • 26
  • 45
0
votes
1 answer

getUrl dropping _format when set to json

I'm trying to generate a url and set the _format variable to json. the .json part is never added to the route. setting to html or xml appends the format correctly. The route from app/console router:debug, api_1_get_page GET ANY ANY …
shapeshifter
  • 2,967
  • 2
  • 25
  • 39
0
votes
2 answers

FOSRestBundle Doctrine extension not working on "PUT" method

I have a problem with FOSRestBundle and Doctrine Extensions. I use Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundleto implement Doctrine Extensions. Here my problem: I have an Entity called "Articles" that has some field feeded by some…
0
votes
1 answer

Using FOSRestBundle to return large table with +100K rows

FOSRestBundle is working fine but whenever I try to return large JSONArray with 50,000 records or more the client takes more than 5 minutes and timeout. This is my controller use FOS\RestBundle\Controller\FOSRestController; use…
mghazal
  • 48
  • 7
0
votes
1 answer

What is the difference between generated Symfony2 controller and FOSRestBundle controller?

I am confused about this question and I would be greatful if someone could give me an explanation with concrete examples. I generated a CRUD controller with Symfony and also implemented FOSRestBundle Controller for REST. They both return the same…
Paul A.
  • 577
  • 2
  • 11
  • 24
0
votes
2 answers

How to get a RESTful response with sub-resource represented as uri using FOS Rest Bundle and Symfony2?

I am using Symfony2 with Doctrine and FOS Rest Bundle (which uses JMS serializer). There are two entities Father and Child: