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

Custom endpoint for handler #40

Open
johannesnagl opened this issue Oct 20, 2015 · 3 comments
Open

Custom endpoint for handler #40

johannesnagl opened this issue Oct 20, 2015 · 3 comments

Comments

@johannesnagl
Copy link

Hi,

is there any way we can add some custom endpoints to a specific handler?

I'm talking about

POST /posts/ for creating elements
POST /posts/<<ID>>/duplicate for duplicating a specific element

When defining a second POST-route I always end up calling the same handlePost() method. Is there any solution for this scenario?

@egeriis
Copy link
Owner

egeriis commented Oct 20, 2015

Hi @johannesnagl

POST /posts is already supported. Depending on the handler method you implement, it can create 1 or more entities.

POST /posts/{id}/duplicate is not a supported method from the JSON API spec. But you could spec an extension and implement your own extension of this library to support this method.

Hope that helps you just a bit?

@johannesnagl
Copy link
Author

POST /posts is already supported. Depending on the handler method you implement, it can create 1 or more entities.

I'm totally aware of this fact! creating new posts works like a charm! but we do need custom routes, as the duplicate action. I've read in the jsonapi specs that they don't have a specific recommendation for these endpoints.

But I do think that the laravel-jsonapi plugin should provide some basic steps to allow this.

@egeriis
Copy link
Owner

egeriis commented Oct 28, 2015

I think there's a valid point in adding the ability to make extensions to this library. I personally do not have any suggestions on how to do this at the moment, but if you have any ideas to kickstart a discussion I am very willing to take part in that +1

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

No branches or pull requests

2 participants