Answer the question
In order to leave comments, you need to log in
How to make a custom endpoint with your own parameters in the Api platform?
Hello everyone,
I'm doing a test task, and I need to connect to an external API to take data from it and display it myself. The problem is what needs to be done using the Api platform, which I have not dealt with before. I understand that it should be used as a layer between my application and an external api, but I want to use a route similar to this /api/route/{startdate}/{enddate}
one and I don’t find the possibility of creating such a route with my own parameters in the api platform. I also don’t have entities, since I don’t work with a database, but there is just a Vacation object into which I convert data from an external api. How to make such a route? and its processing?
Answer the question
In order to leave comments, you need to log in
https://api-platform.com/docs/core/operations/#pre... https://api-platform.com/docs/core/swagger/
annotations are used there like this
/**
* @Route(
* name="book_post_publication",
* path="/books/{id}/publication",
* methods={"POST"},
* defaults={
* "_api_resource_class"=Book::class,
* "_api_item_operation_name"="post_publication"
* }
* )
*/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question