A
A
AlpineMilk2020-09-08 15:35:27
PHP
AlpineMilk, 2020-09-08 15:35:27

How to make custom endpoint with custom parameters in ApiPlatform?

Hello everyone,

I have a task to take data from an external api and display it on a website using symfony and the Api platform.

The user selects the dates and gets the result from the external api. I made an application in the form of a regular rest, but the task has a prerequisite to use the Api platform. And I don't understand how to use it here? My only assumption is:

Api platform should be like a wrapper over an external api from which I will take data, it will have its own endpoint, for exampleapi/get/{startDate}/{endDate}and this endpoint will return json data for the client, I will use reactjs. But in this case, I can’t figure out how to make an endpoint with my own parameters, the api platform shoves the id parameter everywhere, and I only need those 2 parameters that I specify. And I do not use the entity in this project, since I do not write anything to the database, and the api platform needs to be configured through the entity. In general, I do not quite understand how to do this. I’m not particularly familiar with the api platform, and I can’t find how to make such a routeapi/get/{startDate}/{endDate}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daria Motorina, 2020-09-08
@glaphire

https://api-platform.com/docs/core/controllers/#cr...
This looks like what you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question