Apify Discord Mirror

Updated 5 months ago

Suggestion: Adding Batch Execution to the Run API

At a glance

The community member is requesting that the Apify API support array input, similar to the batch execution feature in Apollo GraphQL. Currently, the API only accepts object input, and returns an error when an array is provided. The community member suggests that accepting array input would be advantageous, as it would allow the actor to load the Docker file only once, and then execute the scraper code multiple times with different inputs, creating multiple datasets. The community member also suggests that the API should return an array of run results.

The comments indicate that the Apify team will reply soon, but there is no explicitly marked answer.

Useful resources
Currenly the Apify API doesn't support Array as input.
When we request run API with ARRAY input eg:

requests.post('https://api.apify.com/v2/acts/actorId/run-sync?token=********', json=[{'location': 'indonesia'}])

we get error something like :

{'error': {'type': 'invalid-input', 'message': 'The input JSON must be object, got "array" instead.'}}

Instead error, the API should accept the input as Batch Execution request just like Apollo GraphQL can do: https://www.apollographql.com/docs/router/executing-operations/query-batching/

Advantage:
The Actor only load Docker file once (save load time), then execute Scraper Code multiple time with multiple INPUTS, creating multiple Datasets for each INPUTS.
The run output should also return ARRAY of run results.
S
1 comment
the team will reply soon.
Add a reply
Sign up and join the conversation on Discord