Site icon DataForSEO

Best practices for handling OnPage API requests

Handling low-volume OnPage API payload

From the user perspective, a low-volume payload means a relatively periodic usage of an API with a few thousand requests a day or one-time data collection.

Setting API tasks

	"status_code": 20100,
        "status_message": "Task Created.",

 

	"status_code": 50000,
	"status_message": "Internal Error.",

 

	"status_code": 40501,
	"status_message": "Invalid Field",

 

Also, refer to the Errors endpoint to get a full list of possible errors.

Retrieving API task results

A single-threaded worker service should be launched on your server. It can make requests to the Tasks Ready endpoint, obtain the id of the completed tasks, and collect and process the results. The frequency of launching the worker depends on the number of tasks, as well as on the number of pages to be scanned. For example, you set 1000 tasks with different domains, 100 pages for scanning in each task – in case of such a volume, it will be sufficient to launch the worker once every 15-30 minutes. If the number of pages to be scanned will be larger, the frequency of calling the Tasks Ready endpoint should be increased, for example, to 30-60 minutes.

If you need to collect results from several endpoints:

Handling high-volume OnPage API payload

High-volume payload means frequent usage of an API with many thousands of requests a day, or periodic usage with big volumes of collected data, more than several thousand requests per day.

Setting API tasks

	"status_code": 20100,
	"status_message": "Task Created.",

 

With such a task, you can proceed further. We recommend storing the id parameters of tasks in the database. This way, you will be able to see an id of the task and when it was submitted for processing.

	"status_code": 50000,
        "status_message": "Internal Error.",

 

Also, refer to the Errors endpoint to get a full list of possible errors.

Retrieving API task results

A worker service that communicates with a database has to be launched on your server.

Additional recommendations for using webhooks

Exit mobile version