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

Unable to find template when returning response with FOSRestBundle

I'm using FOS Rest Bundle to build an Api, the problem is that every time I try to return anything I get the error message: "Unable to find template" I don't really want to render a template, but to serialize an entity that I have. Here is my…
danielrvt
  • 10,177
  • 20
  • 80
  • 121
3
votes
1 answer

FOSRestBundle: The controller must return a response (Array()) given

I'm starting with FOSRestBundle. I have added this routing configuration: //Sermovi/Bundle/APIBundle/Resources/config/routing.yml sermovi_api_homepage: type: rest resource:…
tirenweb
  • 30,963
  • 73
  • 183
  • 303
3
votes
2 answers

symfony forms + fos rest

I have two entity classes in a unidirectional many-to-one relation and two fos rest controllers that take care of creating, fetching, updating, and deleting each of them using their own form types (as described here). When creating a new entity on…
Naoki
  • 49
  • 6
3
votes
2 answers

Symfony | FOSRestBundle with FOSFacebookBundle

I have a symfony app which serve a RESTful API(for mobile app) and have backend administration. I can succesfuly login to the backend via facebook, but how should I allow loggin via the RESTful API?
3
votes
2 answers

FOSRestBundle and JMSSerializer runtime expose

My Symfony2 API uses FOSRestBundle and JMSSerializer, with property annotations, but there are many times when I don't want to expose every property. I understand JMS has exclusion groups, but I can't figure out how to include those in my Symfony…
MechEngineer
  • 1,399
  • 3
  • 16
  • 27
3
votes
2 answers

How to expose function result with FosRestBundle?

I am developing an REST API for our system using Symfony2 with FosRestBundle. FosRestBundle is a very good tool but it seems have one limitation: Only properties ( priviate, protected and public ) can be exposed to the API. I would like to expose a…
David Lin
  • 13,168
  • 5
  • 46
  • 46
3
votes
3 answers

REST API and client on same server, need API authentication?

First, let me describe the application: we are working on a web-based software which is some kind of custom help desk application. It requires the user to login (we use FOSUserBundle). After login the user is redirected to the dashboard. From the…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
3
votes
1 answer

Symfony2 firewall and FOSRestBundle

For my web service using FOSRestBundle, I created a firewall that forces a login to access the application. My problem is that when I make a call to the API via ajax, I need to get the error code 401 when the user is not authenticated rather than…
Frank6
  • 1,193
  • 1
  • 11
  • 23
3
votes
1 answer

FOSRestBundle route

I use Symfony2.2 and FOSRestBundle I set #app/config/config/yml myapp_rest: resource: "@MyappRestBundle/Resources/config/routing.yml" type: rest prefix: /v1 and #src/Myapp/RestBundle/Resources/config/routing.yml user: resource:…
Permana
  • 1,972
  • 2
  • 33
  • 51
3
votes
1 answer

FOSRestBundle Serializer Error

I'm getting an error when i work with FOSRestBundle. Fatal error: Class 'JMS\Serializer\SerializationContext' not found in /home/a15net/public_html/kavuklar/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/ViewHandler.php on line 209 It…
Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65
3
votes
1 answer

FOSRestBundle / JMSSerializerBundle: interact with Symfony2 Security roles

I want to serialize and return only a few attributes of my entity with JMSSerializerBundle and FOSRestBundle. For example I have this attributes: User Username E-Mail Birthday Comments Comments Text DateTime Users with the role ROLE_ADMIN…
Ueli
  • 2,301
  • 5
  • 25
  • 29
3
votes
3 answers

FOSRestBundle json decode issue

Using FOSRestbundle, trying to insert data into table using POST and content-type as application/json. My config.yml has the following fos_rest: param_fetcher_listener: true body_listener: true format_listener: default_priorities:…
user1844391
  • 31
  • 1
  • 4
3
votes
3 answers

Using Symfony 2 Forms to validate API inputs

I'm building an API using Symfony2, Doctrine and the FOSRestBundle. I would like to use the forms component to validate API requests that create or modify records and am having a few problems. I have been using the validation component on it's own…
Jeremy
  • 2,651
  • 1
  • 21
  • 28
3
votes
1 answer

Creating a REST API in Symfony2 using FOSRestBundle - schemas and auto-documentation

I'm creating a RESTful API in Symfony2 using the FOSRestBundle, what I would like to do for each service is define each available attribute in an array so I can validate submitted data, and automatically create documentation for each service. Here…
greg
  • 6,853
  • 15
  • 58
  • 71
2
votes
1 answer

How to extend FOSRestBundle RequestBodyParamConverter?

I am new to Symfony (5.3) and would like to extend the RequestBodyParamConverter (FOSRestBundle 3.0.5) to create a REST api. Using @ParamConverter annotation with the RequestBodyParamConverter works fine. However, I would like to create a custom…
FLichter
  • 169
  • 9