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

Rest Api with user access

I am building a new subproject in symfony2 with FOSUserBundle and FOSRestBundle. This subproject should be an backend for the complete project. I want to build another subproject, which consumes the api and build a front-end in desktop system…
Daniel Pomrehn
  • 791
  • 3
  • 8
  • 23
0
votes
2 answers

Convert json encoded String to json object in FosRestBundle

I have a json encoded string in one of my DB fields, e.g. [{"name":"car","price":"10"}] I'm using the FosRestBundle to return the DB-Values in json format and the String above is returned - as String - nothing special until here;) How can this…
Chris
  • 799
  • 6
  • 15
0
votes
1 answer

@ExclusionPolicy("all") and @Expose do nothing

I don't understand why the annotation do nothing on my GET REST API. I have the JMS Serializer in vendor with all the class.. but when i call my webservice, there are all my properties which appears.. Whereas i did an @ExlusionPolicy("all") and just…
Thomas Trabelsi
  • 330
  • 1
  • 8
  • 21
0
votes
1 answer

OroCrm using FOSRestBundle $this->getManager()->createEntity()

I want to create a post API , and i have a problem when the RestController do this line : $entity = $this->getManager()->createEntity(); It's return Null so the process to valid the $form bug and i have a error 500. Whereas i create a new entity…
Thomas Trabelsi
  • 330
  • 1
  • 8
  • 21
0
votes
1 answer

Symfony form type inheritance problems

I am building an API using the FOSRestBundle and performing validation using the Types provided by Symfony. The problem I am facing is that I am trying to find a way to flatten the form type inheritance model that was created when trying to prevent…
Malachi
  • 33,142
  • 18
  • 63
  • 96
0
votes
1 answer

FOSRestbundle: Serialize public method as field

I have an entity with a standard datetimetz field, with standard getter and setter: /** * @var \DateTime * * @ORM\Column(name="date", type="datetimetz") */ private $date; /** * Get date * * @return \DateTime */ public function getDate() { …
csvan
  • 8,782
  • 12
  • 48
  • 91
0
votes
0 answers

Symfony2 how to integrate escapewsseauthenticationbundle with FOSUserBundle

I have an issue using escapewsseauthenticationbundle to secure my API (using FOSRestBundle and FOSUserBundle). With my security.yml, the login always failed and return a 401 status code. I'm using chrome rest console and Teria's wsse header…
Maxime Picard
  • 603
  • 5
  • 17
0
votes
2 answers

How to protect the resources of a user in a REST API with FOSRestBundle and FOSOauthServerBundle?

I'm developing a RESTful web service in Symfony2 with FOSRest and FOSOauthServer bundles (... and many others). My problem is that with an access token of other user, the api gives response instead of a 403 status code. For example: I have two users…
xabi82
  • 111
  • 3
  • 9
0
votes
3 answers

Symfony FosRestBundle - form route without format

I am trying to bootstrap simple REST app using latest Symfony (2.4.5) with FOSRestBundle (dev-master 6b384c1). My configuration: fos_rest: format_listener: true view: view_response_listener: true sensio_framework_extra: view: …
acid
  • 2,099
  • 4
  • 28
  • 41
0
votes
1 answer

save embedded JSON Rest Api

Im using Symfony2 with FOSRestBundle on the server side, and EmberJS as client. im reciving the data from the server like this: { customers:[ { id:3, name:"Joue", currency:{ id:5, iso_code:"BDT" } …
user3568719
  • 1,036
  • 15
  • 33
0
votes
1 answer

Using Autorization header instead of access_token

Using rest client extensino when I try to execute: http://api.domain.com/app_dev.php/api/1.0/resource/get?id=1 Request Header: User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137…
mghazal
  • 48
  • 7
0
votes
1 answer

Symfony REST API and Entity Hierarchy

I am not getting all the attributes I would like to get serialized with FOSRestBundle. I'll try to simplify in the following example: Imagine I have the following Entity Inheritance. class Vehicle { private $id; private…
wildbyte
  • 139
  • 1
  • 10
0
votes
2 answers

Symfony2: My route matches in console, not in browser. Probably due to apache 2.4/php-fpm fcgi config

I am totally new to symfony, doing my first exploratory project. I want to build a REST API, and I installed FOSRestBundle. In my console, the output of php app/console router:debug get_usuarios: [router] Route "get_usuarios" Name …
transient_loop
  • 5,984
  • 15
  • 58
  • 117
0
votes
2 answers

Is CSRF token the cause for not be able to get authenticated in CURL command?

The FOSRestBundle is working perfectly in my project but without authentication. Now, my goal is to make my requests with auth. To do so, I added this firewall in security.yml firewalls: # ... main: pattern: ^/ form_login: …
Amine Jallouli
  • 3,919
  • 8
  • 36
  • 73
0
votes
0 answers

how to handle custom exceptions/flashes messages in a RESTful API with Symfony2

Let's say I run a clothing web shop. I have an order form that my customers can place orders. A customer fills out their order for a t-shirt and submits the form. The problem is the t-shirt is out of stock. This isn't a validation issue, because…
David
  • 10,418
  • 17
  • 72
  • 122