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

Cannot load resource "". Make sure there is a loader supporting the "rest" type

I face this Error while creating a REST API using Symfony V4.99 and fosrestbundle. When I Run php bin/console debug:router I get this: Cannot load resource "App\Controller\ListController". Make sure there is a loader supporting the "rest"…
Meh Di
  • 93
  • 1
  • 10
3
votes
2 answers

Unable to install FOSRestBundle with Symfony 5

I was trying to install FOSRestBundle on Symfony 5 using composer but got the following error message: friendsofsymfony/rest-bundle 2.7.1 requires symfony/config ^3.4|^4.3 Is it possible to manually install FOSRestBundle with Symfony 5; as it…
MyO
  • 413
  • 1
  • 8
  • 19
3
votes
0 answers

Allowing Null keys in JSON response of API-Platform in Symfony Project

{ "@context": "/api/contexts/PackageType", "@id": "/api/package_types", "@type": "hydra:Collection", "hydra:member": [ { "@id": "/api/package_types/1", "@type": "PackageType", "id": 1, "code": "4GwAD", …
3
votes
1 answer

Prevent JMS Serializer to convert CamelCase to UnderscoreCase

i started an API Rest with symfony 4.2 and these bundle (FOSRestBundle, JMS Serializer Bundle). I have an Angular application which send many request with body who has property like firstName, but it doesn't match with my User property while its…
3
votes
1 answer

Why symfony FOSRest bundle doesn't find the right controller?

I have two actions: /** * @Rest\Get("/items/{itemId}") */ public function getAction(UuidInterface $id): View And /** * @Rest\Get("/items/available") */ public function getAvailableAction() : View The thing is that when I'm trying to call…
HELPME
  • 714
  • 14
  • 35
3
votes
1 answer

FOS Rest Bundle: Can the response be gzipped?

I've read the Bundle documentation (FOS rest-bundle), and can't find anything on compressing a response, and I'm unable to set compression to happen at the web-server level. Is there a way to make the bundle return a gzip(or deflate) compressed…
Erik
  • 20,526
  • 8
  • 45
  • 76
3
votes
1 answer

JMS Serializer Annotation Group not working on Entity using Symfony 4

I have been using the Group annotation for years on SF2 and SF3. I'm trying SF4.1. And I'm getting an empty JSON when I send a GET to my endpoint. The interesting parts of my composer.json: "friendsofsymfony/rest-bundle": "^2.3", …
Arco Voltaico
  • 860
  • 13
  • 29
3
votes
1 answer

Symfony 4 FOSRestBundle serializing with JMSSerializer

I am building API with Symfony 4 and FOSRestBundle. I have pretty basic relations: Entity: User.php /** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") */ class User { /** * @ORM\Id() * @ORM\GeneratedValue() *…
Paul Mark
  • 161
  • 3
  • 17
3
votes
1 answer

There are no registered paths for namespace "App". FosRestBundle, Symfony

I receive such a message "There are no registered paths for namespace "App"" while doing a request to my API. I use FosUserBundle. FosRest tries to render the twig view all the time. fos_rest: param_fetcher_listener: true body_listener:…
woj oj
  • 43
  • 1
  • 7
3
votes
1 answer

Empty route path for different methods in symfony

I'm developing an API using Symfony and FOSRestBundle, and want to use the following routes: app/config/routing.yml page: prefix: /page resource: "@PageBundle/Resources/config/routing.yml" PageBundle/Resources/Config/routing.yml page_get: …
3
votes
1 answer

Symfony 3 API REST - Try Catch Exceptions to JSON response format

I create the api rest server with Symfony and these bundles FosRestBundle, jms/serializer-bundle, lexik/jwt-authentication-bundle. How can I send a clean json response format like this : Missing field "NotNullConstraintViolationException" …
csu
  • 385
  • 1
  • 7
  • 20
3
votes
1 answer

Authorizing API requests using FOSOAuthBundle in UnitTests

I try to authorize a test user in my UnitTest cases. For this I create for the tests the following helper function (that is not very handy, but I can make this better afterwards): public function generateOAuthLoginData(EntityManager $em, Client…
mgluesenkamp
  • 529
  • 6
  • 19
3
votes
0 answers

What's the logic of the versioning in symfony fos rest bundle?

It seems there's no clear explanation on the versioning of the fos rest bundle: 1) The default version value is null. What about 2 or "2" or "v2"? versioning: enabled: true default_version: null 2) If I mark the default_version…
Yarco
  • 763
  • 9
  • 18
3
votes
3 answers

How to add a general URI prefix to all routes of a controller with FOSRestBundle?

I have started to implement controllers for an application that is being developed with Symfony. This is my first attempt at using both Symfony and PHP at that task: I usually work with Java, together with either JAX-RS or Spring. I followed this…
AbVog
  • 1,435
  • 22
  • 35
3
votes
0 answers

Send file with Postman to FosRestBundle Symfony

Im trying to upload file to a Symfony app, then retrieve the file from the ParamFetcher of FosRestBundle, finally create a SonataMedia object with the uploaded file. Im stuck on how to upload the file. The entire application has been developed using…