Specifying Actor Memory in Apify API Calls
When working with Apify actors and their API endpoints, you might need to control the memory allocation for optimal performance. If you're using the run-sync-get-dataset-items
endpoint and encountering difficulties specifying the actor's memory, this blog post is for you.
Common Misconception
A common mistake is attempting to include runOptions
with memoryMbytes
or memory
within the API request payload. While this might seem logical, it doesn't work with this particular endpoint.
The Solution
The correct approach is to append &memory=256
(or your desired memory value in megabytes) directly to the API endpoint URL. This simple adjustment ensures that your actor runs with the specified memory allocation.
Example
const APIFY_API_URL = `https://api.apify.com/v2/acts/novi~fast-tiktok-api/run-sync-get-dataset-items?token=***&memory=256`;
Key Takeaway
Remember to consult the Apify documentation for specific API endpoint requirements. In this case, appending the &memory
parameter to the URL is the key to successfully controlling actor memory allocation.
Keywords: Apify, actor memory, API, run-sync-get-dataset-items, memory allocation
Comments
Post a Comment