-
-
Notifications
You must be signed in to change notification settings - Fork 910
[Question] Multiple identifiers in route #3064
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
Comments
That would be Subresources: https://api-platform.com/docs/core/operations/#subresources Although it sounds like they're only supported for GET operations at the moment. |
@jamesisaac Thank you for your response Yes, I know. I saw it in the documentation and I already found a related topics But I really don't understand why it's not implemented, I think it's a basic concept for the REST (https://restfulapi.net/rest-api-design-tutorial-with-example/#model-uris), maybe I am wrong and there is exist another way how to handle but I feel that it's not @dunglas So, If there is exist another "right" way how to PUT\DELETE subresource just direct me :) |
Hi, just use a custom operation with your custom controller like you'd do with a normal symfony application it'll work. |
@soyuka Yes but when you use a custom operation you can only specify the identifier of the current entity, you cannot do something like this :
Because {categoryId} is unknown . Any solution please ? |
Don't specify the path like this but instead just specify a |
I thought that Custom Operation wasn't a good practice ? For Post operation, if you use a DataPersister, the crash will happen after the persist method, when ApiPlatform try to generate the IRI for the related resource IriConverter::getItemIriFromResourceClass I didn't find any solution for this whereas we should only need to decorate the iriConverter, then the parameters identifiers would provide all required route parameters. But how to specify a decorated IriConverter only for a specific route ? Maybe it's overkill ? |
I'm sorry @Rebolon not sure to follow, please open a new issue as it's not really related? You can decorate the IriConverter to support multiple identifiers indeed. |
Hello folks!
How I can configure route with multiple identifiers? For example:
[PUT]
/api/user/{user_id}/post/{post_id}
Some examples you can find here https://symfony.com/doc/master/bundles/FOSRestBundle/6-automatic-route-generation_multiple-restful-controllers.html#define-child-resource-controller
Does this option supported by API Platform?
The text was updated successfully, but these errors were encountered: