Most Popular Phrases (top_words)
top_words - method for finding popular words for building search queries. Use question=1 parameter to analyze questions only.
Pagination
Following parameters can be used for pagination:
- page_size : number of results per page (default: 100, max: 1000)
page : page number (set to the 1st page by default)
Metrics | Description | |
result | Encapsulates the answer | |
total | Number of found related keywords | |
keyword | number of queries per month of the desired phrase | |
hits | an array of top words for the search phrase | |
cnt | how many phrases does the word keyword appear | |
status_msg | Response "OK" or "Error" report on a successful or unsuccessful request | |
status_code | Response code "200" — successful request. Errors occur when limits are exceeded (number of simultaneous requests or account limits) |
|
left_lines |
|
Part of the API response, for which 1 limit is charged:
{
"keyword": "series",
"cnt": 1
}
{
"result": {
"total": 1,
"hits": [
{
"keyword": "with",
"cnt": 1
},
{
"keyword": "gps",
"cnt": 1
},
{
"keyword": "nike+",
"cnt": 1
},
{
"keyword": "series",
"cnt": 1
}
]
},
"status_msg": "OK",
"status_code": 200,
"left_lines": 986486
}
<?php
// This example works on serpstat-sdk only
// https://github.com/SerpstatGlobal/serpstat-sdk
require_once __DIR__ . '/../vendor/autoload.php';
// configure your application
$config = [
'token' => '19666fc1ae1724da1d5ea2f3a99d5f5a',
];
$keywords = 'keywords';
// init client with your serpstat api token
$apiClient = new \Serpstat\Sdk\Core\ApiGuzzleHttpClient($config['token']);
// create instance of any api method class
// list of methods classes in folder src\Methods
$apiMethod = new \Serpstat\Sdk\Methods\top_wordsMethod(
$keywords,
\Serpstat\Sdk\Interfaces\IApiClient::SE_GOOGLE_RU
);
try {
// try call api method
$response = $apiClient->call($apiMethod);
} catch (\Exception $e) {
// catch api error
$response = $e->getMessage();
}
import codecs
import json
import pprint
import urllib.request as urlrequest
from urllib.parse import urlencode
host = 'http://api.serpstat.com/v3'
method = 'top_words'
params = {
'query': 'buy%20laptop', # string for get info
'se': 'g_us', # string search engine
'token': 'ijmiom4f5m34905g03um8342dm04923lre3w', # string personal token
}
api_url = "{host}/{method}?{params}".format(
host=host,
method=method,
params=urlencode(params)
)
try:
json_data = urlrequest.urlopen(api_url).read()
except Exception as e0:
print("API request error: {error}".format(error=e0))
data = json.loads(json_data)
pprint.pprint(data)