General usage
https://api.rankapi.net/v1/pagerank?key=YOUR-API-KEY&url=google.com
where YOUR-API-KEY is your personal API key
Response:
{
"success": true,
"details": null,
"data": [
{
"rank": 10,
"url": "google.com"
}
]
}
For bulk queries use:
https://api.rankapi.net/v1/pagerank?key=YOUR-API-KEY&url=google.com&url=amazon.com
Response:
{
"success": true,
"details": null,
"data": [
{
"rank": 10,
"url": "google.com"
},
{
"rank": 10,
"url": "amazon.com"
}
]
}
How service control resources
You can monitor resource usage via X-RateLimit-Remaining response header. Service records how much requests you did in a calendar day and resets measurement at UTC. When a quota is depleted, service returns HTTP 403 error.
Parsing response
Responses are encoded by json. Here's example using Python and excellent requests library:
import requests
API_KEY = '%MY-API-KEY%'
URL = 'google.com'
response = requests.get('https://api.rankapi.net/v1/pagerank?key=%s&url=%s' % (API_KEY, URL))
if response.status_code == 200:
d = response.json()
if d['success']:
for item in d['data']:
print(item['url'], item['rank'])
For bulk queries:
import requests
API_KEY = '%MY-API-KEY%'
URL = 'google.com'
URL2 = 'amazon.com'
response = requests.get('https://api.rankapi.net/v1/pagerank?key=%s&url=%s&url=%s' % (API_KEY, URL, URL2))
if response.status_code == 200:
d = response.json()
if d['success']:
for item in d['data']:
print(item['url'], item['rank'])
Request limit, HTTP methods, Character Encoding
- Request limit — Request quota depends on your API key
- HTTP methods — Only GET method supported
- Character Encoding — UTF-8
HTTP Response Status Codes
- 200 — Everything is fine
- 400 — Bad request, check request URL
- 403 — Access denied because of invalid api key, quota limitation etc.
- 404 — URL not found
- 500 — Something wrong with the server