});
Methods
The Rankwatch API is a mostly RESTful API. Known caveats:
GET Request handles all selection type api query
POST Request handles all insertion/update api query
DELETE Request handles all deletion type api query
We support two output formats. To use any of them, simply use one of them after the REQUEST PATH :
All authentication is handled using basic HTTP auth .
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2_host = "https://apiv2.rankwatch.com"; $request_path = "/user/profile/"; $output = "json"; $params = ''; $api_req_uri = $apiv2_host . $request_path . $output .'/' . $params; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $api_req_uri); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); $result = curl_exec($curl); curl_close($curl); echo $result;
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/project/add/json/"; $fields = array( 'domain_name' => "rankwatch.com", 'project_name' => RankWatch", 's_id-list' => 1,2 ); $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $apiv2Host); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl);
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $apiv2curl = $apiv2Host . 'project/delete/json/p_id/{p_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $apiv2curl); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ errno: "ERR0001", errmsg: "Error Message" }
http status = 200 (Request is Ok)
http status = 401 (Unauthorized Request)
http status = 402 (Forbidden to acess a particular section)
http status = 500 (Internal server Error)
method : GET
format : json
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'user/profile/json'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ errno:0, errmsg:"Success", data: { user_name: "user", user_email: "user@example.com", phone: 8541256587, begin_date: "2014-01-01", package_expiry_date: "2015-02-01", user_added_on: 2013-12-02, user_keyword_limit: 80000, package_mode: "DAILY" } }
method : GET
format : json
Request URL: https://apiv2.rankwatch.com/project/list/json/This method will return the list of projects added by the user.
By Default the above URL will return only 20 projects. If more projects are needed please pass count as get parameter with value.
e.g : https://apiv2.rankwatch.com/project/list/json/count/100/Default offset value is 0.
e.g : https://apiv2.rankwatch.com/project/list/json/offset/100/Default value for sort is asc (ascending).
Default sort is on project_name.
Two values are allowed for sort:
a. asc (ascending).
b. desc (descending).
e.g : https://apiv2.rankwatch.com/project/list/json/sort/desc/Default value of sort_on is project_name.
Sorting is enabled on only two fields:
a. project_name (Sorting on the basis of project name).
b. created_on (Sorting on the basis of date on which the project was created).
e.g : https://apiv2.rankwatch.com/project/list/json/sort/desc/sort_on/created_on/$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/list/json/count/100/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "total_rows_returned": [ { "project_id": "dummy p_id", "project_created_on": "2014-06-16", "url": "example.com", "project_name": "Example", "search_engines": "2,1,3", "alexa_rank": "311", "google_index": "20900000", "backlink_count": "16746909", }, { "project_id": "dummy p_id", "project_created_on": "2014-06-13", "url": "example2.com", "project_name": "Example 2", "search_engines": "4.00001,201,701", "alexa_rank": "311", "google_index": "20900000", "backlink_count": "16746909", }, { "project_id": "dummy p_id", "project_created_on": "2014-06-12", "url": "example3.com", "project_name": "Example 3", "search_engines": "1", "alexa_rank": "311", "google_index": "20900000", "backlink_count": "16746909", } ], "total_rows_found": 296 }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
This method will return the name of search engines added.
The search_engine_id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
There are two ways of passing search engine ids, either pass one search engine id at a time or pass multiple comma seperated search engine ids.
Also Search engine detail is available on :
http://www.rankwatch.com/api-manager/get-seid.htmlYou need to login into your Rankwatch account to see search engine details from above url.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'searchengine/find/json/s_id/1,2,5,20/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
This method will return the details of a single project keyword by keyword for the lascroll available rank.
Date cannot be passed.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/detail/json/p_id/{project_id}/The search_engine_id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/detail/json/p_id/{project_id}/s_id/{search_engine_id}/The URL id for which the data is needed. It is an optional field, in case data is required for particular URL id.
e.g : https://apiv2.rankwatch.com/project/detail/json/p_id/{project_id}/s_id/{search_engine_id}/u_id/{url_id}By Default the above URL will return only 20 keywords data. If more keywords are needed please pass count as get parameter with value.
e.g : https://apiv2.rankwatch.com/project/detail/json/p_id/{project_id}/s_id/{s_id}/count/100/Default offset value is 0.
e.g : https://apiv2.rankwatch.com/project/detail/json/p_id/{project_id}/s_id/{s_id}/count/10/offset/10/$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/detail/json/p_id/{project_id}/s_id/{search_engine_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "unique_keyword_id": "unique-keyword-id ", "k_id": "Keyword-id ", "u_id": "URL-id ", "keyword": " Keyword ", "added_on": "2014-06-16", "search_engine_id": 1, "search_engine_name": "Google India", "current_rank": 2, "initial_rank": 2, "highest_rank": "1", "rank_difference": "0", "previous_rank": "1", "page_number": 1, "p_id": " project_id ", "url": "example.com", "ranked_url": "example.com/test" "tags": 0, "search_volume": 480, "snippet_data": { "local": 3, "news": 1, "images": 7, "ads": 2, "videos": 0, "answer": 1, "knowledge": 1, "jobs": 2 }, "additional_rankings": { "ads": { "rank": 1, "rank_url": "www.example.com/" }, "answer": { "rank": 1, "rank_url": "www.example.com" } }, "page_score": 65, "screenshot_url": " screenshot_url " (This is the Image URL) }, "total_keywords": 2, "average_rank": 1 ], "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
This method would return all the sub-URLs with its respective Ids added to a project.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/get_suburl/json/p_id/{project_id}/$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/get_suburl/json/p_id/{project_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "u_id": "url_id", "url": "example.com" }, { "u_id": "url_id", "url": "example.com\/products\/watches\/" } ], "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
This method will return the rankings of a particular keyword, depending on the date range provided. By default the date range is of 1 month.
Note : Maximum date range allowed is of 3 months.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/ranking/json/p_id/{project_id}/The search engine id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/ranking/json/p_id/{project_id}/s_id/{search_engine_id}/The keyword id for which the data is needed. It is a mandatory field, if no keyword id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/ranking/json/p_id/{project_id}/s_id/{search_engine_id}/k_id/{keyword_id}/It is the date from which the ranking data is needed. The format of from date should be yyyy-mm-dd (2014-05-03). If any other format is provided an error will be returned. By Default from date is 1 month previous date.
e.g : https://apiv2.rankwatch.com/project/ranking/json/p_id/{project_id}/s_id/{search_engine_id}/k_id/{keyword_id}/from/{yyyy-mm-dd}/to/{yyyy-mm-dd}/It is the date upto which the ranking data is needed. The format of to date should be yyyy-mm-dd (2014-06-03). If any other format is provided an error will be returned. By Default to date is current date.
e.g : https://apiv2.rankwatch.com/project/ranking/json/p_id/{project_id}/s_id/{search_engine_id}/k_id/{keyword_id}/from/{yyyy-mm-dd}/to/{yyyy-mm-dd}/$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/ranking/json/p_id/{p_id}/s_id/{s_id}/k_id/{k_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "k_id": "keyword_id", "keyword": "keyword", "rank": 2, "ranked_url": "ranked url", "url": "example.com", "date": "2014-06-16", "s_id": 1, "snippet_data": { "local": 0, "ads": 2, "news": 0, "images": 0, "videos": 0, "answer": 1, "knowledge": 1, "jobs": 2 }, "additional_rankings": { "ads": { "rank": 1, "rank_url": "www.example.com/" }, "answer": { "rank": 1, "rank_url": "www.example.com" } }, "tag":['abc','xyz'], } ], "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
Note : If rank is 0 , It means keyword rank Not in top 100.
Method : POST
Format : json
Request URL: https://apiv2.rankwatch.com/project/add/json/This method adds project to your account for adding keywords and then start the calculation.
This parameter is mandatory and should be a valid domain name, keyword analysis for rank calculation will be processed on the basis of the domain name entered here.
e.g : rankwatch.comIf you wish to provide your project some specific title, set it as project_name.
This parameter is mandatory, please choose the search engine ID from the list provided to add the project to enable rank tracking at the locations. You need to pass the search engine id's comma seperated.
Example: 1/2/3.00512/2.00421
Search engine detail is available on :
http://www.rankwatch.com/api-manager/get-seid.htmlYou need to login into your Rankwatch account to see search engine details from above url.
This optional parameter disables or enables subdomain tracking feature on/off. By default sub-domain tracking is enabled.
0,1
This optional parameter enables the merge for your rank tracking, when turned on, your organic results and local results displayed with google will be treated as same and the best ranking out of local and organic will be featured as your current ranking.
0,1
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/add/json/'; $fields = array( 'domain_name' =>'example.com', 'project_name' => "Example", 's_id-list' => "1,2", 'sd_track' => '0', 'enable_merge' => '1' ); $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "msg": "1 project added", "p_id": "project_id" }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 rankwatch.com", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
Method : POST
Format : JSON
Request URL: https://apiv2.rankwatch.com/project/edit/json/This method edits your project for search engine ID's being used. Please Note that you can add search engine ID's using this method too. And when a new search engine ID is added, all your keywords for this project are automatically added to the project for this search engine.
Also, If you delete the search engine ID, all your keywords will be deleted.
This field is mandatory and specifies which project is to be edited. Please refer to Project List API to get the unique project identification id.
The search engine ID to be added or removed. depending upon the request made(add or remove). Only 1 search engine id is allowed in one request.
There are two possible values for method :
a. add : This option will add the particular search engine id provided by the user.Note : If no method is provided an error will be returned.
Search engine detail is available on :
http://www.rankwatch.com/api-manager/get-seid.htmlYou need to login into your Rankwatch account to see search engine details from above url.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/edit/json/'; $fields = array( 'p_id' => "project_id", 's_id' => "search_engine_id", 'method' => "add" ); $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": " ", "data": { "msg": "added", "p_id": "project_id", "s_id": "search_engine_id" }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : DELETE
format : JSON
Request URL: https://apiv2.rankwatch.com/project/delete/json/This method is used to delete the project. Please note that you will lose all data related to the project you are deleting.
The unique project identification id to be deleted.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $apiv2curl = $apiv2Host . 'project/delete/json/p_id/{p_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $apiv2curl); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
This method will return the last 10 payments details of the user.
{ errno:0, errmsg:"Success", data: { "transaction_id": "transaction-id", "amount": "amount", "discount": "discount amount", "date": "2014-01-01", "package_name": "FREE", "package_mode": DAILY/WEEKLY, "keyword_limit": 100, } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/keyword/add/json/This method adds keywords into a particular project_id provided by you.
This parameter is the project id in which you want to your keywords to. It is a mandatory field.
It is a mandatory field. It is the keyword which you want to add. You can add single or multiple keyword. ( Please do not enter encoded Keyword and count of keywords should not be more than 5000).
It is the search engine id you want to add your keyword for. If no s_id is provided the keyword will be added for all the search engines.(One at a time)
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'keyword/add/json/'; $fields = array( 'p_id' => "project_id", 's_id' => "search_engine_id", 'kw' => array('KEYWORD1','KEYWORD2'), OR 'kw' => "KEYWORD1" ); $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "Message": "Keywords Successfully Added", "data_entered": [ "K_ID1":"KEYWORD1", "K_ID2":"keyword2" ] }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/project/add_sub_url/json/This method adds sub-url and keywords(optional) into a particular project_id provided by you.
This parameter is the project id in which you want to add your sub-url and keywords to. It is a mandatory field.
It is the sub-url which will be added in a project whose project id has been entered. It is a mandatory field.
It is an optional. It is the keyword which you want to add in the given sub-url. You can add multiple keywords as well. ( Please do not enter encoded Keyword ).
It is the search engine id you want to add your keyword for. If no s_id is provided the keyword will be added for all the search engines.(One at a time)
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $fields = array( 'p_id' => "PROJECT ID", 'sub-url'=>"SUB-URL", 's_id' => "SEARCH ENGINE ID", 'keywords' => array( 'KEYWORD', 'KEYWORD', 'KEYWORD'), OR 'keywords' => "KEYWORD1" ); $curl_url = $apiv2Host . 'project/add_sub_url/json/'; $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "Message": "sub-url with keywords added successfully", "data-entered": { "sub_url": {"SUB-URL-ID":"SUB-URL"}, "search_engine_id" => "SEARCH ENGINE ID", "keywords": [ "K_ID1":"KEYWORD 1", "K_ID2":"KEYWORD 2", "K_ID3":"KEYWORD 3" ] } }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
If keyword not provided
{ "errno": 0, "errmsg": "", "data": [ { "Message": "sub-url added successfully", "data-entered": { "sub_url": {"SUB-URL-ID":"SUB-URL"} } }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/project/exist_sub_url/json/This method adds sub-url and keywords(optional) into a particular project_id provided by you.
This parameter is the project id in which you want to add your sub-url and keywords to. It is a mandatory field.
This parameter is the sub-url unique id in which you want to add keywords. It is a mandatory field.
It is the keyword which you want to add in the given sub-url u_id and p_id. You can add multiple keywords as well. It is a mandatory field. ( Please do not enter encoded Keyword ).
It is the search engine id you want to add your keyword for. If no s_id is provided the keyword will be added for all the search engines.(One at a time)
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $fields = array( 'p_id' => "PROJECT ID", 'u_id'=>"SUB-URL UNIQUE ID", 's_id' => "SEARCH ENGINE ID", 'keywords' => array( 'KEYWORD', 'KEYWORD', 'KEYWORD'), OR 'keywords' => "KEYWORD1" ); $curl_url = $apiv2Host . 'project/exist_sub_url/json/'; $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "Message": "sub-url with keywords added successfully", "sub_url": "SUB-URL", "data-entered": { "search_engine_id" => "SEARCH ENGINE ID", "keywords": [ "K_ID1":"KEYWORD 1", "K_ID2":"KEYWORD 2", "K_ID3":"KEYWORD 3" ] } }, "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : DELETE
format : json
A). https://apiv2.rankwatch.com/keyword/delete/json/ : This will delete a keyword for a particular search_engine_id in that project
B). https://apiv2.rankwatch.com/keyword/delete_all/json/ :This will delete that keyword for all the search_engine_ids inthat project.
1. unique_keyword_id : In this type you need to pass the unique keyword id for the keyword and search engine id combination you want to delete.
unique_keyword_id is a combination of a keyword and search_engine_id (prd_id returned in Project Detail Method is the unique_keyword_id ), if you pass unique_keyword_id then it will remove that keyword search_engine_id pair but in case where p_id and k_id are passed it will delete all the combinations with that keyword.
1. p_id : You need to pass the project id for which the keyword needs to be deleted. It is a mandatory field.
2. k_id : If you want to delete the keyword for all the search engines then pass the k_id of that keyword. It is a mandatory field.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'keyword/delete/json/unique_keyword_id/{unique_keyword_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host .'keyword/delete_all/json/p_id/{p_id}/k_id/{k_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
method : GET
format : json
Request URL: https://apiv2.rankwatch.com/project/webstats/json/This method will return the list of projects added by the user.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/webstats/json/p_id/{project_id}/It is the date from which the webstats data is needed. The format of from date should be yyyy-mm-dd (2014-05-03). If any other format is provided an error will be returned. By Default from date is 1 month previous date.
It is the date upto which the webstats data is needed. The format of to date should be yyyy-mm-dd (2014-06-03). If any other format is provided an error will be returned. By Default to date is current date.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/webstats/json/p_id/{p_id}/from/{yyyy-mm-dd}/to/{yyyy-mm-dd}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
Note: Webstats Data is calculated on weekly basis, so the data is returned with the week number.
{ "errno": 0, "errmsg": "", "data": [ { "week": 42, "project_id": "{p_id}", "alexa_rank": "311", "google_index": "20900000", "backlink_count": "16746909", }, { "week": 41, "project_id": "{p_id}", "alexa_rank": "294", "google_index": "22200000", "backlink_count": "16746909", }, { "week": 40, "project_id": "{p_id}", "alexa_rank": "278", "google_index": "21100000", "backlink_count": "16746909", }, { "week": 39, "project_id": "{p_id}", "alexa_rank": "274", "google_index": "22200000", "backlink_count": "16746909", }, { "week": 38, "project_id": "{p_id}", "alexa_rank": "262", "google_index": "22700000", "backlink_count": "16746909", } ], "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : GET
format : json
Request URL: https://apiv2.rankwatch.com/project/tag/json/This method will return the average rank of each tag for a particular project_id.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/tag/json/p_id/{project_id}/It is the date from which the tag data is needed. The format of from date should be yyyy-mm-dd (2014-05-03). If any other format is provided an error will be returned. By Default from date is 1 month previous date.
It is the date upto which the tag data is needed. The format of to date should be yyyy-mm-dd (2014-06-03). If any other format is provided an error will be returned. By Default to date is current date.
NOTE : You can extract last 1 year data through API. In case you require older data, please contact support@rankwatch.com.$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/tag/json/p_id/{p_id}/from/{yyyy-mm-dd}/to/{yyyy-mm-dd}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "project_name": "PROJECT NAME", "date_range": "FROM DATE to TO DATE", "total_tags": 4, "tag_average_rank":{ "tag1": 3, "tag2": 7, "tag3": 4, "tag4": 5, } } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/competitors/competitor/json/This method will return the organic and paid competitors with associated keywords and paid ads domain name and their details for a particular project_id.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/competitors/competitor/json/p_id/{project_id}/The search engine id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
It is the week number for which the data is needed. It is a mandatory field, if week number is not passed error will be returned. This API will return data for upto last 8 weeks.
It is the year(YYYY) for which the data is needed. It is a mandatory field, if year(YYYY) is not passed error will be returned.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $fields = array( 'p_id' => 'PROJECT ID', 's_id' => 'SEARCH ENGINE ID', 'week' => 'WEEK', 'year' => 'YEAR' ); $curl_url = $apiv2Host . 'competitors/competitor/json/'; $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "domain_name": "DOMAIN NAME", "project_name": "PROJECT NAME", "organic":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "paid":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' } "paid_ads":{ "example.com": [ { "keyword": "KEYWORD", "rank": "RANK", "heading": "HEADING", "content": "CONTENT", "cite": "example.com/KEYWORD" }, { "keyword": "KEYWORD", "rank": "RANK", "heading": "HEADING", "content": "CONTENT", "cite": "example.com/KEYWORD" } ] } }
method : GET
format : json
Request URL: https://apiv2.rankwatch.com/project/startrunnow/json/This method will start the rank calculations for a particular project.
The project id of a project for which rank calculations needs to be started. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/project/startrunnow/json/p_id/{project_id}/$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/startrunnow/json/p_id/{project_id}/'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": "All Runnow has been successfully started...", "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/project/multikwranking/json/This method will return the rankings of multiple keyword, depending on the date range provided. By default the date range is of 1 month.
Note : Maximum date range allowed is of 3 months.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
The search engine id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
The keyword id for which the data is needed. It is a mandatory field, if no keyword id is passed error will be returned.The keyword id is pass in the form of array.You can add single or multiple keyword id in array. ( Count of k_id should not be more than 100).
It is the date from which the ranking data is needed. The format of from date should be yyyy-mm-dd (2018-05-03). If any other format is provided an error will be returned. By Default from date is 1 month previous date.
It is the date upto which the ranking data is needed. The format of to date should be yyyy-mm-dd (2018-06-03). If any other format is provided an error will be returned. By Default to date is current date.
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $curl_url = $apiv2Host . 'project/multikwranking/json/'; $fields = array( 'p_id' => "", 's_id' => "", 'k_id' => array('K_ID1','K_ID2'), 'from' => 'yyyy-mm-dd', 'to' => 'yyyy-mm-dd' ); $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": [ { "k_id": "keyword_id", "keyword": "keyword", "rank": 2, "ranked_url": "ranked url", "url": "example.com", "date": "2018-06-03", "s_id": 1, "snippet_data": { "local": 0, "ads": 2, "news": 0, "images": 0, "videos": 0, "answer": 1, "knowledge": 1, "jobs": 2 }, "additional_rankings": { "ads": { "rank": 1, "rank_url": "www.example.com/" }, "answer": { "rank": 1, "rank_url": "www.example.com" } } } ], "about": { "version": "1.0 build 0001", "copyright": "(c) 2012-24 Rankwatch Pvt Ltd", "web": "www.rankwatch.com", "support": "support@rankwatch.com" } }
Note : If rank is 0 , It means keyword rank Not in top 100.
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/competitors/compsnippet/json/This api method will return the organic, paid, local, news, images, videos, answers, knowledge and jobs field keyword rankings of competitors.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/competitors/compsnippet/json/p_id/{project_id}/The search engine id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
It is the date on which rank details are calculated. It is a mandatory field. It should be in 'YYYY-MM-DD' format
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $fields = array( 'p_id' => 'PROJECT ID', 's_id' => 'SEARCH ENGINE ID', 'date' => 'DATE' ); $curl_url = $apiv2Host . 'competitors/compsnippet/json/'; $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "domain_name": "DOMAIN NAME", "project_name": "PROJECT NAME", "organic":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "paid":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "local":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "news":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "images":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "videos":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "answer":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "knowledge":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' }, "jobs":{ "competitor": 'number of keywords ranked for this competitor out of total keywords' } } }
method : POST
format : json
Request URL: https://apiv2.rankwatch.com/competitors/compads/json/This api method will return the available ads data ranking in every snippet field i.e local, organic, paid ads, news, images, videos, answer, knowledge and jobs. This api provides rankings data along with ranking urls of competitors.
The project id for which the data is needed. It is a mandatory field, if no project id is passed error will be returned.
e.g : https://apiv2.rankwatch.com/competitors/compads/json/p_id/{project_id}/The search engine id for which the data is needed. It is a mandatory field, if no search engine id is passed error will be returned.
It is the date on which rank details are calculated. It is a mandatory field. It should be in 'YYYY-MM-DD' format
Competitor domains of whom the related data needs to be fetched. It is a mandatory field. It should be as an comma seperated array value
Use this input to specify the number of keywords to be skipped while fetching data in multiple api calls for projects with large set of kws Default Value is 0
Use this input to specify the no. of kws fetched at each api call. Maximum limit is 500. Please note response time may increase while fetching large no of kws. Default Value is 20
$token = "YOUR TOKEN"; $password = "YOUR PASSWORD"; $apiv2Host = "https://apiv2.rankwatch.com/"; $fields = array( 'p_id' => 'PROJECT ID', 's_id' => 'SEARCH ENGINE ID', 'date' => 'DATE', 'competitors' => ['COMPDOMAIN1','COMPDOMAIN2','COMPDOMAIN3'], 'offset' => 0, 'limit' => 500, ); $curl_url = $apiv2Host . 'competitors/compads/json/'; $fields_string = http_build_query($fields); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curl_url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "$token:$password"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($curl); curl_close($curl); echo $result;
{ "errno": 0, "errmsg": "", "data": { "domain_name": "DOMAIN NAME", "project_name": "PROJECT NAME", "paid_ads":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL"; "heading": "HEADING", "content": "CONTENT", "cite": "example.com/KEYWORD" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "heading": "HEADING", "content": "CONTENT", "cite": "example.com/KEYWORD" }, ] }, "local":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "organic":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "news":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "images":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "videos":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "answer":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "knowledge":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] }, "jobs":{ "KEYWORD": [ { "yourdomain": "DOMAIN", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, { "competitor": "COMPETITOR", "rank": "RANK", "rank url": "DOMAIN.COM/URL", "previous rank": "PREVIOUS RANK". "previous rank url": "DOMAIN.COM/URL" }, ] } }