-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Response structure on save #23
Comments
Hi there. |
Hi, For GET on "/users/1" I return "[{"username":"Michael","id":"1"}]". So far so good but when I do a POST on "/users" I should return "[{"username":"Michael","id":"1"}]" as above but in your adapter I must return "{"username":"Michael","id":"1"}" without the array to make it work. I hope this clears things up? |
@realsurfer, that is correct. Look here: So I dont believe your right. Cheers, |
Well there is no official spec which is why no api is the other like. Thanks! |
What are you using server side? What are you using? |
I am using the Laravel framework. But the framework doesn't impose any structure for the response body, that is entirely up to the developer. I can't see that the SLIM framework does anything different in this regard. There is no official restful spec just a lot of guidelines and everyone doing their own implementation so adding flexibility would make the adapter work in more use cases. |
I see your point. I would be interested in a PR, where you make the parsing more general. Flexibility would be very great to have built in. |
I'll look into it as soon as I can and see what I can contribute. It would be nice if the adapter could automatically handle both use cases. |
Hi,
First, thanks for creating this great adapter!
On fetching models and collections I have been serving the objects enclosed in an array like below:
{"meta":"","users":[{"username":"Michael","id":"1"}]}
However when creating a new model and posting to the api the adapter expects the response object without the array. Is this the expected behavior? Seems a little inconsistent.
Thanks,
Michael
The text was updated successfully, but these errors were encountered: