Skip to content
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

Support for posting to Controller Archetype endpoints #184

Closed
AndreasRadsziwill6447 opened this issue Feb 26, 2020 · 3 comments · Fixed by #202
Closed

Support for posting to Controller Archetype endpoints #184

AndreasRadsziwill6447 opened this issue Feb 26, 2020 · 3 comments · Fixed by #202
Milestone

Comments

@AndreasRadsziwill6447
Copy link

Hi,

currently ketting assumes that a post will result in creating a new resource.
However there are endpoint you might post to, that will not create such new resources but rather perform some kind of action (similar to a remote procedure call).

These Controller archetype endpoints (https://restfulapi.net/resource-naming/) could respond with a status 200 and arbitrary payload (maybe some related resource to the action that was performed)

It would be great if the Resource.post() function was a bit more flexible and processed a response body for status = 200 responses too.

Or maybe Controller archetype endpoints shouldn't be part of a HATEOAS API, or use a different HTTP verb to trigger the action?

@evert
Copy link
Collaborator

evert commented Feb 26, 2020

I agree, this makes sense. Right now we return a new resource if:

  1. It was a 201 Created response
  2. It had a Location header

For 200 OK we could just return whatever we received, and wouldn't break existing implementations. So I'm down this .

@mattbishop
Copy link

Hypermedia API POST responses can be 200 with a body, and that's OK (pun intended). It's useful for hypermedia APIs that use POST to send queries instead of using GET with URL params. I talk about how the client can control the response with a "Representation" profile mixin: https://level3.rest/profiles/mixins/representation

@evert
Copy link
Collaborator

evert commented Feb 27, 2020

@mattbishop , having support for return=representation is also planned, but we'll handle that a little differently. Basically, we'll warm the cache with whatever was returned.

Tracked here #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants