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.