Get click reports at the date/link granularity within a date range.
Method: GET (paginated)
Parameters:
Response:
{
"reports": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"date": "string",
"marketplace": "amazon.com",
"linkId": "string",
"creatorId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"brandId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clicks": 0,
"final": true
}
],
"cursor": "string"
}
Errors:
Example:
const API_KEY = "LEVANTA_API_KEY"
const ENDPOINT = "<https://app.levanta.io/api/seller/v1/reports/clicks>"
let cursor;
const reports = [];
// Set up query parameters
const parameters = new URLSearchParams();
// Get 50 reports per response
parameters.set("limit", 50);
// Get reports from January 15, 2023 to February 15, 2023
parameters.set("start", "2023-01-15T00:00:00.000Z");
parameters.set("end", "2023-02-15T00:00:00.000Z");
// Paginate through reports, stop when a value of null is returned for "cursor"
while (cursor !== null) {
const response = await fetch(`${ENDPOINT}?${parameters.toString()}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
});
const json = await response.json();
// Store reports returned
reports.push(...json.reports);
cursor = json.cursor;
if (cursor) parameters.set("cursor", cursor);
}
console.log(reports);