Usage Data
Frequently Asked Questions
What's Covered?
In this guide you’ll learn more about making API calls to the Usage Data endpoint for the Links API V2.
This endpoint Returns the number of rows consumed so far in the current billing period. The count returned might not reflect rows consumed in the last hour. The count returned reflects rows consumed by requests to both the v1 (Mozscape) and v2 Links APIs.
This documentation specifies information for Moz Links API V2. V1 of the Links API does not include a Usage Data endpoint.
Quick Links
- Getting Started
- Endpoint Location
- Request Syntax
- Example JSON Request
- Example JSON Request - No Parameters
- Request Parameters
- Response Syntax
- Example JSON Response
- Response Elements
- Errors
- Example HTTP Request
- Example cURL Request
- Example Python Request
- Example HTTP Request - No Parameters
- Example cURL Request - No Parameters
- Example Python Request - No Parameters
Getting Started
Before making calls to the Usage Data endpoint, be sure you are set up with an Access ID and Secret Key within your Moz Account.
Just a reminder - the Links API V2 supports Basic Auth in which you are able to use your Access ID as a username and and your Secret Key as a password.
All requests and responses are structured in JSON.
Endpoint Location
When requesting usage data from Links V2, be sure to use the following endpoint
https://lsapi.seomoz.com/v2/usage_data
Request Syntax
{ "start": "string", "end": "string" }
Please note: this request can be made without specifying a time frame with the following syntax
{}
Example JSON Request
{ "start": "18374", "end": "1635466367" }
Example JSON Request - No Parameters
{}
Request Parameters
“start” - The start of the time period to get usage data for, represented in Unix time (seconds since 00:00:00 UTC, 1 January 1970). This must be less than 'end'. Note that this should be an integer, passed as a string. The default time is the start of the current month.
Type: string
“end” - The end of the time period to get usage data for, represented in Unix time (seconds since 00:00:00 UTC, 1 January 1970). Note that this should be an integer, passed as a string. This must be greater than 'start'. The default is the current time.
Type: string
Response Syntax
{ "rows_consumed": number }
Example JSON Response
{ "rows_consumed": 64 }
Response Elements
"rows_consumed" - The number of rows consumed in the time period specified. The count returned might not reflect rows consumed in the last hour. (If no time period is specified, the results returned will reflect rows consumed so far in the current billing period.)
- Type: string
Errors
See the Common Errors section for errors that are common to all endpoints.
Example HTTP Request
POST /v2/usage_data Host: lsapi.seomoz.com Content-Length: [length of request payload in bytes] User-Agent: [user agent string] Authorization: Basic [credentials] { "start": "0", "end": "1635466367" }
Example cURL Request
curl -d '{“start”: “1569888000”, “end”: “1635724799”}' -X POST https://lsapi.seomoz.com/v2/usage_data -u 'access_id:secret_key'
import requests auth = (access_id, secret_key) url = “https://lsapi.seomoz.com/v2/usage_data” data = “””{ "start": "0", "end": "1635466367" }””” request = requests.post(url, data=data, auth=auth)
Example HTTP Request - No Parameters
POST /v2/usage_data Host: lsapi.seomoz.com Content-Length: [length of request payload in bytes] User-Agent: [user agent string] Authorization: Basic [credentials] {}
Example cURL Request - No Parameters
curl -d '{}' -X POST https://lsapi.seomoz.com/v2/usage_data -u 'access_id:secret_key'
Example Python Request - No Parameters
import requests auth = (access_id, secret_key) url = “https://lsapi.seomoz.com/v2/usage_data” data = ”{}” request = requests.post(url, data=data, auth=auth)
Related Articles
Was this article helpful?
Yes! Amazing! Yes! It was what I needed. Meh. It wasn’t really what I was looking for. No, it wasn’t helpful at all.
Thanks for the feedback.