ill-bronzeI
Apify & Crawlee3y ago
4 replies
ill-bronze

Return data to API call

Hello,

I'm trying to return the data from an Apify actor via the same REST API call that initiated the actor.

Is this possible?

This page says I need to put the value in OUTPUT in the "default key-value store":

https://docs.apify.com/platform/tutorials/run-actor-and-retrieve-data-via-api#synchronous-runs-with-dataset-output

But the "put record" documentation seems to require a key value store ID. Is there a default here?

https://docs.apify.com/api/v2#/reference/key-value-stores/record/put-record

So I'm trying to figure out how to return data. From within the Actor, am I supposed to call the key-value store API, put a new record, with the recordKey of OUTPUT, and JSON data of the value? If so, what should storeId be?

Is there an easier way to do this? I wish I could just type return and return the value ...
image.png
Learn how to run an actor/task via the Apify API, wait for the job to finish, and retrieve its output data. Your key to integrating actors with your projects.
Run actor and retrieve data via API | Apify Documentation
Was this page helpful?