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

Symfony FOSRestBundle + WSSE + FOSUserBundle

I'm having trouble setting up a wsse security on my Symfony API. I'm following the tutorial Configure WSSE on Symfony with FOSRestBundle based on How to Create a custom Authentication Provider The issues are : How do I manage to use FOSUserBundle…
adaba
  • 374
  • 1
  • 18
3
votes
1 answer

Symfony2 FOSRestBundle ParamFetcher JSON error

I have a Symfony2 setup with FOSRestBundle and I'm using the ParamFetcher. I now have a route which has some requirements for it's parameters and I'd like to show a the error messages to the API-user, but in my current setup the error messages are…
ivodvb
  • 1,164
  • 2
  • 12
  • 39
3
votes
1 answer

How to return or display data in JSON format using FOSRestBundle

I am working in a Restful API using Symfony2 and FOSRestBundle. I have read view layer docs but is not clear to me how to handle output for API. What I want to achieve is simple: display or return or output the result as valid JSON. This is what I…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
3
votes
1 answer

Proper way to use Accept header in a REST api made with Symfony2 and FOSRestBundle

I am trying to make my web services return the right format when sent with an Accept header. For example, if I send 'Accept: application/xml', it should return in xml format, and if I send 'Accept: application/json', should return in json…
Nuno Barreto
  • 121
  • 7
3
votes
0 answers

How to make @View annotation working using FOSRestBundle

I'm using the FOSRestBundle in my RESTful Symfony2 app. I want to serialize the entity by using JMS. Unfortunately the @View annotations doesn't have any effect. They seems be not used at all. But when using…
3
votes
2 answers

Fosrestbundle body empty when multipart request

In the code bellow I expect the $request->getContents() to get the body content of the HTTP request. When sending non multipart request this works as expected though when using multipart requests the $body variable remains empty. public function…
Roel Veldhuizen
  • 4,613
  • 8
  • 44
  • 78
3
votes
1 answer

FOSRestBundle add http basic auth

I added FOSRestBundle to my symfony2 app, this app already had a public area and an admin area protected by FOSUserBundle. My problem is, I don't get browser to prompt for user/password and also, when connecting api with curl I don't get…
K. Weber
  • 2,643
  • 5
  • 45
  • 77
3
votes
2 answers

Error 500 with FOSRestBundle and Behat

I'm trying to test my API with Behat, but I get 500 on every response. The API works fine outside of Behat. Here is the part of my config.yml file for the bundle : fos_rest: param_fetcher_listener: true body_listener: true …
skwi
  • 334
  • 5
  • 18
3
votes
2 answers

FOSRestBundle jsonp request force to download

My config for fos_rest section: fos_rest: serializer: serialize_null: true view: view_response_listener: force force_redirects: html: true formats: jsonp: true json: true …
debianek
  • 589
  • 1
  • 9
  • 30
3
votes
1 answer

how to get always array from JMS Serializer?

/** * This function is used to get all Stopes. * * @ApiDoc( * resource=true, * section="Stop", * description="This function is used to get all Stopes", * statusCodes={ * 200="Returned when successful", * 404="Returned…
3
votes
2 answers

Symfony2 custom form type key pair

I'm currently trying to implement a key-pair value for a form type, which is used together with the FOSRestBundle to allow for sending a request like the following: { "user": { "username": "some_user", "custom_fields": { …
GManz
  • 1,548
  • 2
  • 21
  • 42
3
votes
2 answers

FOSRestBundle, FOSOAuthServerBundle, FOSUserBundler - how to integrate them?

On my symfony2 project, I'm using FOSUSerBundle for login, register, etc on a Website. Works fine, as I expected. But now I'd like to build a REST API, so that a android app can act as client to and work with the data. I found FOSRestBundle to…
3
votes
6 answers

How to handle entity update (PUT request) in REST API using FOSRestBundle

I am prototyping a REST API in Symfony2 with FOSRestBundle using JMSSerializerBundle for entity serialization. With GET request I can use the ParamConverter functionality of SensioFrameworkExtraBundle to get an instance of an entity based on the id…
Cvuorinen
  • 1,319
  • 1
  • 11
  • 14
3
votes
1 answer

FOSRestBundle: How to Avoid Automatic Pluralization of POST /login Route?

I have this Action to handle the user login also via REST api call: /** * Login Action * * @param Request $request */ public function postLoginAction(Request $request) { This is what php app/console router:debug shows me: en__RG__post_login …
electronix384128
  • 6,625
  • 11
  • 45
  • 67
3
votes
0 answers

Edit image in FOSUserBundle

I need help to edit image profil.I can register in FOSUserBundle ( adding image to database, and other ) and replay a profil (replay all custom from database) and i can edit profile except the image.I follow the…
razzek
  • 595
  • 7
  • 23