laravel-jsonapi icon indicating copy to clipboard operation
laravel-jsonapi copied to clipboard

POST and PUT request not using `attributes`

Open parampal opened this issue 9 years ago • 1 comments

I just wanted to double check how a typical POST/PUT request should look like for this lib to work.

It seems you don't expect the attributes to be placed within the attributes element like below. Instead you expect the attributes simply inside data. This is easy enough to change (inside Handler->parseRequestContent()) - was there a reason why its done this way? Am i missing something?

{ "data": { "type": "resource", "id": "", "attributes": { "name": "blah blah", "age": "5" } } }

The spec follows what I've done above: http://jsonapi.org/format/#crud

Thanks mate,

parampal avatar Oct 08 '15 06:10 parampal

Yes, there's a specific reason. That reason being that this library was build initially for a previous version of the JSON API spec—RC3 if I recall correctly.

Feel free to do a pull request, as the goal should be for this library to be v1 compliant.

egeriis avatar Oct 20 '15 14:10 egeriis