### Retrieve Apple App Reviews tasks with Python Source: https://docs.dataforseo.com/v3/app_data/apple/app_reviews/tasks_ready Python example using the DataForSEO REST client to get completed Apple App Reviews tasks. Requires installation of client library and valid API credentials. ```python from client import RestClient client = RestClient("login", "password") response = client.get("/v3/app_data/apple/app_reviews/tasks_ready") ``` -------------------------------- ### Fetch Google My Business Info Live with C# Source: https://docs.dataforseo.com/v3/business_data/google/my_business_info/live This C# example demonstrates how to call the DataForSEO API for Google My Business live information using HttpClient and Newtonsoft.Json. It sets up authentication, defines the task parameters (language, location, keyword), sends a POST request, and deserializes the JSON response. It includes error handling based on the status code. ```csharp using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace DataForSeoDemos { public static partial class Demos { public static async Task business_data_info_live() { var httpClient = new HttpClient { BaseAddress = new Uri("https://api.dataforseo.com/"), // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) } }; var postData = new List(); // example #1 - a simple way to set a task // this way requires you to specify a location, a language of search, and a keyword. postData.Add(new { language_code = "en", location_code = 1023191, keyword = "RustyBrick, Inc." }); // POST /v3/business_data/google/my_business_info/live var taskPostResponse = await httpClient.PostAsync("/v3/business_data/google/my_business_info/live", new StringContent(JsonConvert.SerializeObject(postData))); var result = JsonConvert.DeserializeObject(await taskPostResponse.Content.ReadAsStringAsync()); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (result.status_code == 20000) { // do something with result Console.WriteLine(result); } else Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}"); } } } ``` -------------------------------- ### Generate Google Keyword Ideas Live with DataForSEO API (C#) Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/keyword_ideas/live This C# example demonstrates how to fetch live Google keyword ideas using the DataForSEO API. It utilizes `HttpClient` and `Newtonsoft.Json` for making the POST request and deserializing the JSON response. The code includes setting up authorization headers, constructing the request body with relevant parameters, and handling success or error responses. Ensure the Newtonsoft.Json NuGet package is installed. ```csharp using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace DataForSeoDemos { public static partial class Demos { public static async Task dataforseo_labs_google_keyword_ideas_live() { var httpClient = new HttpClient { BaseAddress = new Uri("https://api.dataforseo.com/"), // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) } }; var postData = new List(); postData.Add(new { keywords = new[] { "phone", "watch" }, location_name = "United States", language_name = "English", filters = new object[] { new object[] { "keyword_info.search_volume", ">", 10 } }, limit = 3 }); // POST /v3/dataforseo_labs/google/keyword_ideas/live // the full list of possible parameters is available in documentation var taskPostResponse = await httpClient.PostAsync("/v3/dataforseo_labs/google/keyword_ideas/live", new StringContent(JsonConvert.SerializeObject(postData))); var result = JsonConvert.DeserializeObject(await taskPostResponse.Content.ReadAsStringAsync()); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (result.status_code == 20000) { // do something with result Console.WriteLine(result); } else Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}"); } } } ``` -------------------------------- ### Get Google Questions and Answers Task Result (JavaScript) Source: https://docs.dataforseo.com/v3/business_data/google/questions_and_answers/task_get This JavaScript example uses the 'request' library to make a GET request to the DataForSeo API to retrieve the results of a Google Questions and Answers task. It includes setting up the request options, headers, and handling the response. Ensure you have the 'request' library installed. ```javascript var request = require('request'); var options = { 'method': 'GET', 'url': 'https://api.dataforseo.com/v3/business_data/google/questions_and_answers/task_get/04261229-1535-0577-0000-e3c2f0a46daf', 'headers': { 'Content-Type': 'application/json', 'Authorization': 'Basic c3VwcG9ydEBkYXRhZm9yc2VvLmNvbTpTUnJYVHp2UGtFSjgzdXlz' } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); ``` -------------------------------- ### POST /v3/serp/google/organic/task_post Source: https://docs.dataforseo.com/v3/serp/google/news/live/html Sets up a Live SERP API task by sending task parameters in a JSON array within the generic POST body. Supports up to 2000 API calls per minute, with each call limited to one task. Parameters include keyword, location, language, and optional fields like URL and search engine domain. ```APIDOC ## POST /v3/serp/google/organic/task_post ### Description Sets a task for the Live SERP API by posting task parameters in JSON format. The request body should contain an array of tasks, where each task is an object with the specified fields. Data is sent in UTF-8 encoded JSON, and each API call is limited to one task. Up to 2000 calls per minute are allowed. ### Method POST ### Endpoint /v3/serp/google/organic/task_post ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body The request body is a JSON array containing task objects. For example: [{"keyword": "rank tracker api", ...}]. - **url** (string) - Optional - Direct URL of the search query. Example: `https://www.google.co.uk/search?q=rank%20tracker%20api&hl=en&gl=GB&uule=w+CAIQIFISCXXeIa8LoNhHEZkq1d1aOpZS`. Note: This method is difficult for the API and requires specifying exact language and location in the URL. - **keyword** (string) - Required - The search keyword, up to 700 characters. Special characters like %25 for %, %2B for +. Certain parameters like 'allinanchor:' multiply the charge by 5. Queries with 'cache:' are not supported. Learn more in the Help Center: https://dataforseo.com/help-center/rules-and-limitations-of-keyword-and-keywords-fields-in-dataforseo-apis - **location_name** (string) - Required if location_code or location_coordinate not specified - Full name of search engine location. Example: `London,England,United Kingdom`. Retrieve available locations via https://api.dataforseo.com/v3/serp/google/locations - **location_code** (integer) - Required if location_name or location_coordinate not specified - Search engine location code. Example: `2840`. Retrieve available locations via https://api.dataforseo.com/v3/serp/google/locations - **location_coordinate** (string) - Required if location_name or location_code not specified - GPS coordinates in "latitude,longitude,radius" format. Latitude and longitude up to 7 decimal digits, radius from 199.9mm to 199999mm. Example: `53.476225,-2.243572,200` - **language_name** (string) - Required if language_code not specified - Full name of search engine language. Example: `English`. Retrieve available languages via https://api.dataforseo.com/v3/serp/google/languages - **language_code** (string) - Required if language_name not specified - Search engine language code. Example: `en`. Retrieve available languages via https://api.dataforseo.com/v3/serp/google/languages - **os** (string) - Optional - Device operating system. Values: windows (default), macos. Note: API provides desktop-only results. - **se_domain** (string) - Optional - Custom search engine domain. Example: `google.co.uk`, `google.com.au`. If not specified, chosen automatically based on location and language. ### Request Example ```json [ { "keyword": "rank tracker api", "location_name": "London,England,United Kingdom", "language_name": "English", "os": "windows", "se_domain": "google.co.uk" } ] ``` ### Response #### Success Response (200) Returns task ID and status. Response details not fully specified in the provided text. #### Response Example ```json [ { "id": "12345678901234567890", "status": "pending" } ] ``` ``` -------------------------------- ### Retrieve completed tasks from API Source: https://docs.dataforseo.com/v3/serp/google/dataset_search/tasks_fixed Make an HTTP GET request to retrieve a list of completed tasks from the DataForSEO API. The examples show authentication setup and basic error handling. Replace 'login' and 'password' with your actual API credentials. ```javascript const axios = require('axios'); axios({ method: 'get', url: 'https://api.dataforseo.com/v3/serp/google/dataset_search/tasks_fixed', auth: { username: 'login', password: 'password' }, headers: { 'content-type': 'application/json' } }).then(function (response) { var result = response['data']['tasks'][0]['result']; // Result data console.log(result); }).catch(function (error) { console.log(error); }); ``` ```csharp using Newtonsoft.Json; using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace DataForSeoDemos { public static partial class Demos { public static async Task serp_tasks_fixed() { var httpClient = new HttpClient { BaseAddress = new Uri("https://api.dataforseo.com/"), // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) } }; // using this method you can get a list of completed tasks // GET /v3/serp/google/dataset_search/tasks_fixed // in addition to 'google' and 'dataset_search' you can also set other search engine and type parameters // the full list of possible parameters is available in documentation var response = await httpClient.GetAsync("/v3/serp/google/dataset_search/tasks_fixed"); var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (result.status_code == 20000) { // do something with result Console.WriteLine(result); } else Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}"); } } } ``` -------------------------------- ### Setting a Technology Task with Technology Paths (JSON) Source: https://docs.dataforseo.com/v3/domain_analytics/technologies/technologies_summary/live This snippet demonstrates how to set up a task for the domain analytics technologies summary API by specifying `technology_paths`. It includes example paths for 'wordpress' and 'salesforce'. This is useful when you need to target specific technologies by their group and name. ```json { "task_settings": { "technology_paths": [ { "path": "content.cms", "name": "wordpress" }, { "path": "marketing.crm", "name": "salesforce" } ] } } ``` -------------------------------- ### Retrieve Lighthouse Task Results via API (JavaScript) Source: https://docs.dataforseo.com/v3/on_page/lighthouse/task_get/json This JavaScript example uses Axios to make a GET request to the DataForSEO API to retrieve the results of a Lighthouse task using a provided task ID. It handles both successful responses by logging the task data and errors by logging the error object. Ensure you have the 'axios' library installed. ```javascript const task_id = '02231934-2604-0066-2000-570459f04879'; const axios = require('axios'); axios({ method: 'get', url: 'https://api.dataforseo.com/v3/on_page/lighthouse/task_get/json/' + task_id, auth: { username: 'login', password: 'password' }, headers: { 'content-type': 'application/json' } }).then(function (response) { var result = response['data']['tasks']; // Result data console.log(result); }).catch(function (error) { console.log(error); }); ``` -------------------------------- ### Get Google App Info HTML Results with Python Source: https://docs.dataforseo.com/v3/app_data/google/app_info/task_get/html This snippet illustrates how to retrieve Google App Info HTML results using Python's RestClient. Ensure the RestClient library is installed and API credentials are setup correctly for successful data retrieval. This code lists completed tasks to obtain HTML results. ```python from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") # 1 - using this method you can get a list of completed tasks # GET /v3/app_data/google/app_info/tasks_ready response = client.get("/v3/app_data/google/app_info/tasks_ready") ``` -------------------------------- ### Retrieve SERP Competitors via Python Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/serp_competitors/live This Python example demonstrates how to use the RestClient to fetch SERP competitors data. It includes setting up the client, defining the request parameters, and making the POST request. ```python from client import RestClient client = RestClient("login", "password") post_data = dict() post_data[len(post_data)] = dict( keywords=[ "phone", "watch" ], location_name="United States", language_name="English", filters=[ ["relevant_serp_items", ">", 0], "or", ["median_position", "in", [ 1, 10 ]] ] ) response = client.post("/v3/dataforseo_labs/google/serp_competitors/live", post_data) ``` -------------------------------- ### Example JSON Response for Keyword Overview Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/keyword_overview/live Presents a sample JSON response from the DataForSEO Labs Keyword Overview API. Includes nested data for search volume trends, demographics, keyword properties, and backlink metrics. Useful for understanding the response structure and parsing logic. ```JSON { "search_volume": 964653, "clickstream_keyword_info": { "search_volume": 737851, "last_updated_time": "2025-01-04 00:08:42 +00:00", "gender_distribution": { "female": 51, "male": 49 }, "age_distribution": { "18-24": 22, "25-34": 19, "35-44": 25, "45-54": 32, "55-64": 2 }, "monthly_searches": [ { "year": 2024, "month": 12, "search_volume": 737850 } ] }, "keyword_properties": { "se_type": "google", "keyword_difficulty": 89, "detected_language": "en" }, "serp_info": { "se_type": "google", "check_url": "https://www.google.com/search?q=iphone&num=100&hl=en&gl=US&gws_rd=cr&ie=UTF-8&oe=UTF-8&glp=1&uule=w+CAIQIFISCQs2MuSEtepUEUK33kOSuTsc", "se_results_count": 13380000000 }, "avg_backlinks_info": { "se_type": "google", "backlinks": 1333333.7, "dofollow": 1048624.3, "referring_pages": 1077104.1 }, "search_intent_info": { "se_type": "google", "main_intent": "informational" } } ``` -------------------------------- ### Retrieve Seznam SERP Locations Using Python Source: https://docs.dataforseo.com/v3/serp/seznam/locations This Python script uses the RestClient class to get the list of locations supported by Seznam for SERP. Requires the RestClient module installed or downloaded from the DataForSEO examples. Authentication is done with login and password. ```python from random import Random from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") # using this method you can get a list of locations # GET /v3/serp/seznam/locations # in addition to 'seznam' you can also set other search engine # the full list of possible parameters is available in documentation response = client.get("/v3/serp/seznam/locations") ``` -------------------------------- ### GET /v3/serp/bing/organic/tasks_ready Source: https://docs.dataforseo.com/v3/serp/bing/organic/tasks_ready Specific endpoint example for getting completed tasks for Bing organic SERP. Includes code examples in Python, JavaScript, and C#. Your account is not charged when receiving results. Each separate task remains on the list until collected. You can make up to 20 API calls per minute, getting up to 1000 tasks completed within three previous days. ```APIDOC ## GET /v3/serp/bing/organic/tasks_ready ### Description Obtains a list of completed SERP API tasks for Bing organic search. ### Method GET ### Endpoint https://api.dataforseo.com/v3/serp/bing/organic/tasks_ready ### Parameters None ### Request Example N/A ### Response #### Success Response (20000) - **version** (string) - API version number - **status_code** (integer) - Status code (20000 for success) - **status_message** (string) - Status message - **time** (string) - Time taken for the response - **cost** (integer) - Cost incurred (0 for this endpoint) - **tasks_count** (integer) - Number of tasks returned - **tasks_error** (integer) - Number of error tasks - **tasks** (array) - Array of task objects #### Response Example ``` { "version": "0.1.20200129", "status_code": 20000, "status_message": "Ok.", "time": "0.2270 sec.", "cost": 0, "tasks_count": 1, "tasks_error": 0, "tasks": [ { "id": "11151406-0696-0087-0000-e781cb0144a1", "status_code": 20000, "status_message": "Ok.", "time": "0.0388 sec.", "cost": 0, "result_count": 2, "path": [ "v3", "serp", "bing", "organic", "tasks_ready" ], "data": { "api": "serp", "function": "tasks_ready", "se": "bing", "se_type": "organic" }, "result": [ { "id": "11081554-0696-0066-0000-27e68ec15871", "se": "bing", "se_type": "organic", "date_posted": "2019-11-08 13:54:43 +00:00", "tag": "tag1", "endpoint_regular": "/v3/serp/bing/organic/task_get/regular/11081554-0696-0066-0000-27e68ec15871", "endpoint_advanced": "/v3/serp/bing/organic/task_get/advanced/11081554-0696-0066-0000-27e68ec15871", "endpoint_html": "/v3/serp/bing/organic/task_get/html/11081554-0696-0066-0000-27e68ec15871" }, { "id": "11151406-0696-0066-0000-c4ece317cdb2", "se": "bing", "se_type": "organic", "date_posted": "2019-11-15 12:06:09 +00:00", "tag": "tag2", "endpoint_regular": "/v3/serp/bing/organic/task_get/regular/11151406-0696-0066-0000-c4ece317cdb2", "endpoint_advanced": "/v3/serp/bing/organic/task_get/advanced/11081554-0696-0066-0000-27e68ec15871", "endpoint_html": "/v3/serp/bing/organic/task_get/html/11151406-0696-0066-0000-c4ece317cdb2" } ] } ] } ``` ### Authentication Basic HTTP authentication is required. Use your DataForSEO login and password. ### Code Examples #### Python ```python # you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if response["status_code"] == 20000: print(response) # do something with result else: print("error. Code: %d Message: %s" % (response["status_code"], response["status_message"])) ``` #### JavaScript ```js const axios = require('axios'); axios({ method: 'get', url: 'https://api.dataforseo.com/v3/serp/bing/organic/tasks_ready', auth: { username: 'login', password: 'password' }, headers: { 'content-type': 'application/json' } }).then(function (response) { var result = response['data']['tasks'][0]['result']; // Result data console.log(result); }).catch(function (error) { console.log(error); }); ``` #### C# ```csharp using Newtonsoft.Json; using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace DataForSeoDemos { public static partial class Demos { public static async Task serp_tasks_ready() { var httpClient = new HttpClient { BaseAddress = new Uri("https://api.dataforseo.com/"), // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) } }; // using this method you can get a list of completed tasks // GET /v3/serp/bing/organic/tasks_ready // in addition to 'bing' and 'organic' you can also set other search engine and type parameters // the full list of possible parameters is available in documentation var response = await httpClient.GetAsync("/v3/serp/bing/organic/tasks_ready"); var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (result.status_code == 20000) { // do something with result Console.WriteLine(result); } else Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}"); } } } ``` ``` -------------------------------- ### Get Keywords For Site - Python Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_site/live This Python code snippet shows how to integrate with the Keywords For Site API using a provided RestClient. It illustrates sending a POST request with target domain, location, language, and options to include SERP information and subdomains. The example also shows how to apply filters and set a limit for the results. ```python from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") post_data = dict() # simple way to set a task post_data[len(post_data)] = dict( target="apple.com", location_name="United States", language_name="English", include_serp_info=True, include_subdomains=True, filters=["keyword_properties.keyword_difficulty", ">", 0], limit=3 ) # POST /v3/dataforseo_labs/google/keywords_for_site/live response = client.post("/v3/dataforseo_labs/google/keywords_for_site/live", post_data) ``` -------------------------------- ### Fetch SERP Data from Naver using DataForSEO API V3 (JavaScript) Source: https://docs.dataforseo.com/v3/serp/naver/organic/tasks_fixed This JavaScript example uses the 'axios' library to make a GET request to the DataForSEO API V3's Naver organic tasks endpoint. It authenticates using basic auth and processes the response data, logging either the results or any errors encountered. Ensure 'axios' is installed via npm. ```javascript const axios = require('axios'); axios({ method: 'get', url: 'https://api.dataforseo.com/v3/serp/naver/organic/tasks_fixed', auth: { username: 'login', password: 'password' }, headers: { 'content-type': 'application/json' } }).then(function (response) { var result = response['data']['tasks'][0]['result']; // Result data console.log(result); }).catch(function (error) { console.log(error); }); ``` -------------------------------- ### Retrieve SERP Competitors via PHP Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/serp_competitors/live This PHP example shows how to use the RestClient to fetch SERP competitors data. It includes setting up the client, defining the request parameters, and handling the response. ```php [ "phone", "watch" ], "language_name" => "English", "location_code" => 2840, "filters" => [ ["relevant_serp_items", ">", 0], "or", ["median_position", "in", [ 1, 10 ]] ] ); try { $result = $client->post('/v3/dataforseo_labs/google/serp_competitors/live', $post_array); print_r($result); } catch (RestClientException $e) { echo "n"; print "HTTP code: {$e->getHttpCode()}n"; print "Error code: {$e->getCode()}n"; print "Message: {$e->getMessage()}n"; print $e->getTraceAsString(); echo "n"; } $client = null; ?> ``` -------------------------------- ### PHP Client Example for DataForSEO API Source: https://docs.dataforseo.com/v3/merchant/amazon/products/task_get/advanced Example PHP code demonstrating how to use the RestClient to fetch Amazon product tasks and their results. It shows how to get a list of ready tasks and then retrieve the results for each completed task. ```APIDOC ## PHP Client Example for DataForSEO API ### Description This PHP code snippet demonstrates how to interact with the DataForSEO API using the provided RestClient. It illustrates fetching a list of completed tasks and then retrieving the detailed results for each task. ### Method GET ### Endpoint `/v3/merchant/amazon/products/tasks_ready` and `/v3/merchant/amazon/products/task_get/advanced/$id` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the completed task (used in `task_get/advanced/{id}`). #### Query Parameters None #### Request Body None ### Request Example ```php get('/v3/merchant/amazon/products/tasks_ready'); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (isset($tasks_ready['status_code']) AND $tasks_ready['status_code'] === 20000) { foreach ($tasks_ready['tasks'] as $task) { if (isset($task['result'])) { foreach ($task['result'] as $task_ready) { // #2 - using this method you can get results of each completed task // GET /v3/merchant/amazon/products/task_get/advanced/$id if (isset($task_ready['endpoint_advanced'])) { $result[] = $client->get($task_ready['endpoint_advanced']); } // #3 - another way to get the task results by id /* if (isset($task_ready['id'])) { $result[] = $client->get('/v3/merchant/amazon/products/task_get/advanced/' . $task_ready['id']); } */ } } } } print_r($result); // do something with result } catch (RestClientException $e) { echo "\n"; print "HTTP code: {$e->getHttpCode()}\n"; print "Error code: {$e->getCode()}\n"; print "Message: {$e->getMessage()}\n"; print $e->getTraceAsString(); echo "\n"; } $client = null; ?> ``` ### Response #### Success Response (20000) - **status_code** (integer) - Indicates that the request was successful. - **tasks** (array) - Contains details about the tasks, including results. - **result** (array) - An array of results for the completed task. - **endpoint_advanced** (string) - The endpoint to fetch advanced results for the task. #### Response Example ```json [ { "status_code": 20000, "tasks": [ { "result": [ { "product_url": "https://www.amazon.com/dp/B0XXXXXX", "title": "Example Product Title", "price": "$19.99", "...": "..." } ], "endpoint_advanced": "/v3/merchant/amazon/products/task_get/advanced/your_task_id" } ] } ] ``` ``` -------------------------------- ### Fetch Google Keyword Overview Live Data (C#) Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/keyword_overview/live This C# code snippet utilizes HttpClient and Newtonsoft.Json to call the DataForSeo API for Google Keyword Overview live data. It sets up authentication using Basic encoding and constructs the request payload with keyword, location, and language. The code deserializes the JSON response and includes logic for handling success and error status codes. ```csharp using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace DataForSeoDemos { public static partial class Demos { public static async Task dataforseo_labs_google_keyword_overview_live() { var httpClient = new HttpClient { BaseAddress = new Uri("https://api.dataforseo.com/"), // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) } }; var postData = new List(); postData.Add(new { keywords = new[] { "iphone" }, location_name = "United States", language_name = "English" }); // POST /v3/dataforseo_labs/google/keyword_overview/live // the full list of possible parameters is available in documentation var taskPostResponse = await httpClient.PostAsync("/v3/dataforseo_labs/google/keyword_overview/live", new StringContent(JsonConvert.SerializeObject(postData))); var result = JsonConvert.DeserializeObject(await taskPostResponse.Content.ReadAsStringAsync()); // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors if (result.status_code == 20000) { // do something with result Console.WriteLine(result); } else Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}"); } } } ``` -------------------------------- ### Get Yahoo SERP Locations via Python Source: https://docs.dataforseo.com/v3/serp/yahoo/locations This Python example fetches a list of Yahoo SERP locations using the RestClient class. Requires valid login credentials and uses the GET method. Download the client library from DataForSEO examples. ```python from random import Random from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") # using this method you can get a list of locations # GET /v3/serp/yahoo/locations # in addition to 'yahoo' you can also set other search engine # the full list of possible parameters is available in documentation response = client.get("/v3/serp/yahoo/locations") ``` -------------------------------- ### Get Google Keyword Overview with Python Source: https://docs.dataforseo.com/v3/dataforseo_labs/google/keyword_overview/live This Python example shows how to use the RestClient to fetch Google Keyword Overview data. It sets up the API client with credentials and prepares the POST data including keywords, location, and language. ```python from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") post_data = dict() # simple way to set a task post_data[len(post_data)] = dict( keywords=[ "iphone" ], location_name="United States", language_name="English" ) # POST /v3/dataforseo_labs/google/keyword_overview/live response = client.post("/v3/dataforseo_labs/google/keyword_overview/live", post_data) ``` -------------------------------- ### GET /v3/serp/seznam/organic/tasks_ready Source: https://docs.dataforseo.com/v3/serp/seznam/organic/tasks_ready Obtain a list of completed tasks for the 'seznam' search engine with 'organic' type. This is a specific example of the more general endpoint. ```APIDOC ## GET /v3/serp/seznam/organic/tasks_ready ### Description This endpoint retrieves a list of completed tasks for the "seznam" search engine and "organic" search type. It's a specific instance of the more general tasks_ready endpoint. ### Method GET ### Endpoint https://api.dataforseo.com/v3/serp/seznam/organic/tasks_ready ### Parameters No specific path or query parameters are detailed for this exact endpoint in the provided text, but it implies the use of `se` and `type` parameters in the general case. ### Request Example ``` GET https://api.dataforseo.com/v3/serp/seznam/organic/tasks_ready Authorization: Basic YW5kcmV3LndhbmdoYW5lQGdtYWlsLmNvbTpwYXNzd29yZA== ``` ### Response #### Success Response (20000) - **tasks** (array) - Contains a list of completed tasks. Each task object includes: - **id** (string) - The unique identifier for the task. - **status_code** (integer) - The status code of the task. - **status_message** (string) - A message describing the task status. - **time** (string) - The time taken to process the task. - **cost** (integer) - The cost associated with the task. - **result_count** (integer) - The number of results returned for the task. - **path** (array) - The API path used for the task. - **data** (object) - Contains API and function details. - **result** (array) - An array of actual search results or task-specific data. #### Response Example ```json { "version": "0.1.20200129", "status_code": 20000, "status_message": "Ok.", "time": "0.2270 sec.", "cost": 0, "tasks_count": 1, "tasks_error": 0, "tasks": [ { "id": "11151406-0696-0087-0000-e781cb0144a1", "status_code": 20000, "status_message": "Ok.", "time": "0.0388 sec.", "cost": 0, "result_count": 2, "path": [ "v3", "serp", "seznam", "organic", "tasks_ready" ], "data": { "api": "serp", "function": "tasks_ready", "se": "seznam", "se_type": "organic" }, "result": [ { "id": "11081554-0696-0066-0000-27e68ec15871", "se": "seznam", "se_type": "organic", "date_posted": "2019-11-08 13:54:43 +00:00", "tag": "tag1", "endpoint_regular": "/v3/serp/seznam/organic/task_get/regular/11081554-0696-0066-0000-27e68ec15871", "endpoint_advanced": "/v3/serp/seznam/organic/task_get/advanced/11081554-0696-0066-0000-27e68ec15871", "endpoint_html": "/v3/serp/seznam/organic/task_get/html/11081554-0696-0066-0000-27e68ec15871" } ] } ] } ``` ``` -------------------------------- ### Create Google My Business Q&A Task via Shell, PHP, and Python Source: https://docs.dataforseo.com/v3/business_data/google/questions_and_answers/task_post This snippet demonstrates how to create a task for retrieving Google My Business questions and answers using the DataForSEO API. It includes examples in Bash (cURL), PHP, and Python, showing required authentication, request payload, and optional parameters such as priority and pingback URL. The request returns task IDs which can later be used to fetch the results. ```Shell # Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access login="login" password="password" cred="$(printf ${login}:${password} | base64)" curl --location --request POST "https://api.dataforseo.com/v3/business_data/google/questions_and_answers/task_post" \ --header "Authorization: Basic ${cred}" \ --header "Content-Type: application/json" \ --data-raw '[ { "language_code": "en", "location_name": "Los Angeles,California,United States", "keyword": "The Last Bookstore" } ]' ``` ```PHP 1013962 "language_code" => "en", "keyword" => mb_convert_encoding("The Last Bookstore", "UTF-8") ); // example #2 - a way to set a task with additional parameters // high priority allows us to complete a task faster, but you will be charged more money. // after a task is completed, we will send a GET request to the address you specify. Instead of $id and $tag, you will receive actual values that are relevant to this task. $post_array[] = array( "location_name" => "Los Angeles,California,United States", "language_name" =>"English", "keyword" => mb_convert_encoding("The Last Bookstore", "UTF-8"), "priority" => 2, "tag" => "some_string_123", "pingback_url" => 'https://your-server.com/pingscript?id=$id&tag=$tag' ); // this example has a 2 elements, but in the case of large number of tasks - send up to 100 elements per POST request if (count($post_array) > 0) { try { // POST /v3/business_data/google/questions_and_answers/task_post $result = $client->post('/v3/business_data/google/questions_and_answers/task_post', $post_array); print_r($result); // do with post result } catch (RestClientException $e) { echo "\n"; print "HTTP code: {$e->getHttpCode()}\n"; print "Error code: {$e->getCode()}\n"; print "Message: {$e->getMessage()}\n"; print $e->getTraceAsString(); echo "\n"; } } $client = null; ?> ``` ```Python from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") post_data = dict() # after a task is completed, we will send a GET request to the address you specify # instead of $id and $tag, you will receive actual values that are relevant to this task post_data[len(post_data)] = dict( location_name="Los Angeles,California,United States", language_name="English", keyword="The Last Bookstore", tag="some_string_123", pingback_url="https://your-server.com/pingscript?id=$id&tag=$tag" ) # /v3/business_data/google/questions_and_answers/task_post response = client.post("/v3/business_data/google/questions_and_answers/task_post", post_data) ``` -------------------------------- ### Set Keywords For Site Task via Python Source: https://docs.dataforseo.com/v3/keywords_data/google_ads/keywords_for_site/task_post This Python script demonstrates setting up 'Keywords For Site' tasks using the DataForSEO API client. It provides examples of task configurations, including specifying location by name or code, and setting up pingback URLs for asynchronous results. ```python from client import RestClient # You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip client = RestClient("login", "password") post_data = dict() # simple way to set a task post_data[len(post_data)] = dict( location_name="United States", target="dataforseo.com" ) # after a task is completed, we will send a GET request to the address you specify # instead of $id and $tag, you will receive actual values that are relevant to this task post_data[len(post_data)] = dict( location_code=2840, target="dataforseo.com", tag="some_string_123", pingback_url="https://your-server.com/pingscript?id=$id&tag=$tag" ) # after a task is completed, we will send a POST request to the address you specify # instead of $id and $tag, you will receive actual values that are relevant to this task post_data[len(post_data)] = dict( location_name="United States", target="dataforseo.com", postback_url="https://your-server.com/postbackscript" ) ```