Site icon DataForSEO

Best practices for handling Keywords Data API requests

General recommendations (only for Google Ads)

Live requests

Unless the high data throughput is critical, we do not recommend collecting data using this endpoint. Google Ads API has a load limit, so there are strict rate limits from our side, and Google Ads API itself may return errors like:

	"status_code": 50301,
	"status_message": "Too many requests.",

 

When we use the schemes described below, we balance the load by ourselves, perform tasks at the optimal speed, and you will not receive errors related to the rate limit.

Handling low-volume Keyword Data 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

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, collect and process the results. Set the frequency for launching the worker:

Handling high-volume Keyword Data 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.

Setting API tasks

Retrieving API task results

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

If you are using pingbacks:

  1. Your web server obtained a get GET request where the id parameter is the id of the completed task.
  2. Completed tasks should be appropriately labeled.
  3. Worker identifies completed tasks continuously or periodically, depending on the capabilities of your server. Completed tasks are collected through the Task Get endpoint using the id parameters of these tasks. You can regulate the workload of the server by setting up the appropriate frequency of launching the worker.
  4. After all the previous steps are completed, you can process the retrieved results.

If you are using postbacks:

  1. Your web server obtained a POST that contains the results of the completed task (note that data is sent in the compressed .gz format and thus requires decoding).
  2. After the previous step is completed, you can process the results.

Additional recommendations for using the webhooks

Exit mobile version