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

Method Not Allowed with FosRestBundle

I have an API with some controllers for their respective entities. They have all the same structure, but in one of them I have this error when I try to delete a value. No route found for "DELETE /api/categories/4": Method Not Allowed (Allow: GET,…
Brjtr
  • 157
  • 4
  • 17
2
votes
1 answer

Validation for arrays in ParamFetcher Symfony FOSRestBundle

I need some validation for array attributes in my ParamFetcher params: Example: /** * @RequestParam(name="client[name]", strict=true, requirements="...") * @RequestParam(name="client[phone]", strict=true, requirements="...") */ public function…
user4488093
2
votes
1 answer

Event 'kernel.request' doesn't dispatch correctly

I'm trying tu use LexikJWTAuthBundle with FOSRestBundle to securize my API routes. It works well when I manually give the JWT in the header of my requests, but for my app I would like to add it automatically in each API requests' header via the…
Maxime Picard
  • 603
  • 5
  • 17
2
votes
2 answers

Symfony 3 FOS Rest + JMS Serializer groups

My composer.json (part of it): { "require": { "symfony/symfony": "3.1.*", "jms/serializer-bundle": "^1.1", "friendsofsymfony/rest-bundle": "^2.1" } } I have some entities which I'd like to return partial data for the…
Wanderson Silva
  • 1,179
  • 1
  • 17
  • 35
2
votes
0 answers

Symfony 3.2 FOSRestBundle 2.0 ignores disable_csrf_role

After upgrading symfony 3.1.7 to 3.2 all the forms failed due to csrf validation ("errors": ["The CSRF token is invalid. Please try to resubmit the form."]). I had also run composer update on all the packages. In config i have the following just to…
BrokenPixel
  • 73
  • 1
  • 8
2
votes
0 answers

Integrity constraint violation: 1048 and Default value

i try to create an entity with fosrestBundle, symfony and doctrine If i give all the datas in my json, it works I have one field 'test' that cannot be null and it has the defeault value "0" in my entity, i have : /** * @var smallint */ private…
pop_up
  • 1,451
  • 2
  • 18
  • 35
2
votes
1 answer

Symfony FOSRestBundle enableMaxDepthChecks default to true

Is it possible to set the default value for enableMaxDepthChecks to true? Currently I have to add the following annotation to every route: @View(serializerEnableMaxDepthChecks=true) Is there a way to set this in the config or elsewhere to be the…
Shawn Northrop
  • 5,826
  • 6
  • 42
  • 80
2
votes
0 answers

Symfony 3 FOSRestBundle Routing issue

I am fairly new to Symfony and I am trying to set up a Restful web service using the FOSRestBundle. I am using the following version of Symfony and the bundle symfony/symfony v3.1.6 The Symfony PHP framework friendsofsymfony/rest-bundle 2.1.0 …
IWebb
  • 86
  • 1
  • 6
2
votes
1 answer

Pagination route problems with willdurand hateoas bundle

I'm currently developping some REST web services using Hateoas and I'd like to implement pagination for some longer list display. Note : Database retrieve logic isn't implemented yet This is my controller : use…
2
votes
1 answer

serialize array of objects using Doctrine and JMSSerializer annotations

I have a model /** * @ORM\Table(name="polygon") * @ORM\Entity(repositoryClass="MyBundle\Repository\PolygonRepository") * @JMS\ExclusionPolicy("none") */ class Polygon { /** * @var string * …
2oppin
  • 1,941
  • 20
  • 33
2
votes
0 answers

Symfony FOSRestBundle 2.0 : configure exception wrapper handler

I used to configure the FOSRestBundle 1.7 exception wrapper handler like it's described in the documentation : http://symfony.com/doc/1.7/bundles/FOSRestBundle/4-exception-controller-support.html I'm doing this in order to display Exception with my…
Masacc
  • 106
  • 8
2
votes
1 answer

FOSRESTBundle: how to alter serializer metadatadirs at controller level

How can I specify a metadata dir for the serializer used by FOSRestBundle, at controller level? I can't set it up in config.yml because in my case it depends on the request's route. I've seen in JMSSerializer doc that I could use the following…
marcv
  • 1,874
  • 4
  • 24
  • 45
2
votes
1 answer

How to directly access an image from web directory using FOSREST

As a service, i want to access an image inside of "web/uploads". When i'm trying to do that, it's returning: No route found for "GET /web/uploads/" But i just want to access an image inside this directory. I'm uploading images and i need to load…
Otuyh
  • 2,384
  • 5
  • 22
  • 40
2
votes
1 answer

FosRestBundle mixing twig and json

I have a full working project using symfony, and i need to add some rest api inside of it. I'm using FosRestBundle, and it's already working in my localhost using the following configs: # FOSRest Configuration fos_rest: body_listener: true …
Otuyh
  • 2,384
  • 5
  • 22
  • 40
2
votes
1 answer

How to make POST call using FOSRestBundle

I am trying to setup a RESTFUL web service using FOSRestBunble, but I have some problem making POST calls, here's my setup: app/config/routing.yml rest: type: rest resource: "routing_rest.yml" prefix:…
user3174311
  • 1,714
  • 5
  • 28
  • 66