Integrating the Apify platform with your system involves accessing it via API. The Apify API provides endpoints that allow you to start your Actors or tasks, wait for the run to finish, and retrieve the data.
There are two ways to run your Actors and tasks via API:
Synchronously - For runs shorter than 5 minutes. Returns the data automatically.
Asynchronously - For runs over 5 minutes.
To run an Actor or task, send a POST request to an endpoint such as https://api.apify.com/v2/acts/ACTOR_NAME_OR_ID/runs?token=YOUR_TOKEN
. Include any required input in a JSON object in the request's body.
You can test the API and its endpoints using desktop clients such as Postman.
If you are using a synchronous endpoint, you can relax and wait for your data. Otherwise, you will need to wait for the run to finish using webhooks, polling, or the waitForFinish parameter. Once the run is finished, you can collect your data from its dataset or key-value store.
โ
See the full tutorial and code examples for running Actors and tasks via API. You can find a full description of the Apify API in our documentation.