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

PHP FOSRestBundle using PUT method

I am trying to use Symfony 2 with FOSRestBundle, I've got my GET and POST functions working fine and i've got it returning an array fine with PUT however i cannot get my query string or input. I've tried the obvious $_POST, $_GET, $_PUT and even…
Glow
  • 41
  • 2
  • 10
0
votes
1 answer

Duplicate definition of column 'username' on entity FOSUserBundle FOSRestBundle JMSSerializerBundle

I am trying to use FOSUserBundle with FOSRestBundle and JMSSerializer. I have successfully got the RESTFul modules working so i am able to access /api/v1/users/ however it returns all DB fields from FOSUserBundle and i want to be able to specify…
Glow
  • 41
  • 2
  • 10
0
votes
1 answer

Generate API Routes using FOSRestBundle containing the same common parameter

I'm using FOSRestBundle to build my API, but I'm stuck in middle of something I need which is every API route should contain a default parameter, an API key to check for permissions, but I don't want to put it on every action on my API because I'm…
Victor NWD
  • 123
  • 1
  • 9
0
votes
1 answer

How to restrict who can obtain a valid access token?

I've developed an APIRest service to consume data from a mobile app. I've used the Symfony2 bundles: FOSOAuthServerBundle, FOSUserBundle and FOSRestBundle and all work fine but I need to differenciate the admin panel users and the api users because…
0
votes
1 answer

FosRestBundle + AngularJS : Post request is empty

I'm working on an API with FosRestBundle and AngularJS for the front part. GET requests working but i have problems with POST requests. In the API controller the request object is empty.. Here is the front part $http.post(Route.api + '/leads',…
Benjamin B.
  • 473
  • 5
  • 15
0
votes
2 answers

symfony2 unable to receive json response in controller

I am developing REST API with FOSRestBundle. I am unable to send JSON response from controller. I am forwarding a request from fooAction of FooControllerFoo to a certain of BarController, when I try to return JSON response from that action I am…
Rahul
  • 2,189
  • 7
  • 40
  • 60
0
votes
1 answer

Symfony routing for a REST API / Single page app

I'm trying to setup routes for my Symfony2 single page app and I'm not sure how to go about it correctly without it feeling super hacky. Here is what I need it to do and how I've attempted to set it up: When Authenticated Any route requesting…
greg
  • 6,853
  • 15
  • 58
  • 71
0
votes
0 answers

Submit a Post to symfony FosRestBundle

As I try to use a REST API, I setted up a simple controller which should only return my POST Vars as a xml response. Unfortunately, it won't return it. I guess I have some probs by getting the data from the request. This is my Action inside the…
TheTom
  • 934
  • 2
  • 14
  • 40
0
votes
2 answers

Symfony2 injecting Doctrine Dbal as service on constructor

Trying to pass a Doctrine dbal connection to my construct in a controller. I am following this link to do it but it is not working: How do you access Doctrine DBAL in a Symfony2 service class? Here is my service inside…
Hard Fitness
  • 452
  • 3
  • 9
  • 24
0
votes
1 answer

FOSRestBundle specify default format on custom route as JSON

Having problems with FOSRestBundle custom routes, i followed the below link but that didn't solve my problem. My problem is that when i don't specify a format it defaults to XML not JSON. How to specify default format for FOS\RestBundle to…
Hard Fitness
  • 452
  • 3
  • 9
  • 24
0
votes
1 answer

FOSRestBundle annotations not working

FOSRestBundle annotations are not working for me somehow. use FOS\RestBundle\Controller\Annotations as Rest; // ... /** * @Rest\RequestParam(name="email") */ public function someAction(Request $request) { // some code } Here's my…
Roman Kliuchko
  • 499
  • 4
  • 20
0
votes
1 answer

How to validate a POST request for postUserAction

I get a problem with the validation of a new user request on my api. I know there's a problem in my code but I cannot figure it out : UserType postUserAction And I send via google Postman, this json : { "username":"Username", …
Romain
  • 3,586
  • 7
  • 31
  • 52
0
votes
1 answer
0
votes
2 answers

Symfony Form validates Datetime wrong

When I want to insert a Datetime into my Entity 'Event' with a Form it delivers following Error: I use the FOS/RestBundle: { code: 400 message: "Validation Failed" -errors: { -children: { name: [ ] description: [ ] -begin:…
fsteinbauer
  • 161
  • 1
  • 1
  • 13
0
votes
1 answer

FOSRestBundle: just trying to return an empty form for new elements

I have this code to response with a form to create new customers: public function getNewAction() { $form = new CustomerType(); $view = $this->view($form, 200) ->setTemplate("PlacasFrontendBundle:Customer:newCustomer.html.twig") ; …
tirenweb
  • 30,963
  • 73
  • 183
  • 303