Skip to main content
All CollectionsFor ShopsTechnical
PriceSpy Analytics Reporting API
PriceSpy Analytics Reporting API

The PriceSpy / Prisjakt Analytics Reporting API is the most advanced way of programmatically accessing analytics data.

P
Written by Prisjakt B2B
Updated over 3 years ago

With PriceSpy Analytics Reporting API, you can access the following data for your profiled shops at Prisjakt:

  • Daily cost per price segment

  • Daily number of clicks per price segment

  • Number of Shop Reviews with Ratings from 90 days ago

You can access data from all PriceSpy markets and all shops associated with your PriceSpy Analytics account.

How it works

In order to the user PriceSpy Analytics Reporting API, you must:

Access the API directly and build your own reporting app

The base address of the API is:

https://api.schibsted.com/prisjakt/analytics.

Requests

The PriceSpy Analytics Reporting API is based on REST principles. Data resources are accessed via standard HTTPS requests in UTF-8 format to an API endpoint.

The following HTTP verbs are available:

  • GET - Retrieve resources

  • POST - Login or create resources

Rate Limiting

Rate limiting is applied as per application based on the Client ID. The returned HTTP headers of any API request show your current rate limit status:

  • X-RateLimit-Limit - The maximum number of requests you're permitted to make per hour.

  • X-RateLimit-Remaining - The number of requests remaining in the current rate limit window.

  • X-RateLimit-Reset - The time in milliseconds when the current rate limit window resets.

HTTP status code 429 is used to indicate that the current rate limit has been exceeded.

Status: 429 Too Many Requests
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 600000

Responses

The PriceSpy Analytics Reporting API returns all response data as a JSON object.

  • 200 OK - The request has succeeded. The client can read the result of the request in the body

  • 400 Bad request - The request could not be understood by the server. See message body for more detailed information

  • 401 Unauthorized - The request requires user credentials or the credentials have been refused by the server

  • 403 Forbidden - The server understood the request, but refused to fulfill it

  • 404 Not Found - The requested resource could not be found

  • 429 Too Many Requests - Rate limiting has been applied

  • 500 Internal Server Error - If you get one of those please contact our support

The PriceSpy Analytics Reporting API uses one format to describe an error. The error object follows RFC7807.

$ curl -X GET https://api.schibsted.com/prisjakt/analytics/user

{
"title": "Not authenticated",
"status": 401,
"detail": "Not authenticated"
}

Authorization

All requests to The PriceSpy Analytics Reporting API require authorization. To prove that the user has granted permission, the request header sent by the application must include a valid access token. As the first step towards authorization, you will need to register your application. This will give you a unique client ID to use in all requests.

In order to authorize, invoke the auth endpoint with username and password.

curl --request POST \
--url https://api.schibsted.com/prisjakt/analytics/auth \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-client-id: {API Client ID}' \
--data username={username} \
--data password={password} \
--data grant_type=password

The response will contain an access token which allows you to make requests to The PriceSpy Analytics Reporting API on behalf of a user.

{
"access_token":"...",
"expires_in":3600,
"token_type":"Bearer"
}

User

The user endpoint will give you information about your user and which shops you can fetch offers from.

curl --request GET \
--url https://api.schibsted.com/prisjakt/analytics/user \
--header 'Authorization: Bearer {Access Token}' \
--header 'x-client-id: {API Client ID}'

{
"username":"user",
"shops":[{"id":"id","name":shopName,"currency":"currency"}]
}

Offers

The offers endpoint will give you all clicks and the cost for a specific shop, per day and segment. You can only fetch information for the shops you have access to.

$ curl -i -X GET -H "x-client-id: clientId" -H "Authorization: Bearer eyJhbG..." https://api.schibsted.com/prisjakt/analytics/shops/<shopId>/offers?from_date=2020-06-05T00:00:00Z&to_date=2020-06-05T23:59:59Z

date,market,segment,clicks,cost,currency
2020-06-05,se,A,27,43.2,SEK
2020-06-05,se,B,30,73.5,SEK

To get the response in application/json, set the Accept header in the request.

$ curl -X GET -H "x-client-id: clientId" -H "Authorization: Bearer eyJhbG..." -H "Accept: application/json" https://api.schibsted.com/prisjakt/analytics/shops/<shopId>/offers?from_date=2020-06-05T00:00:00Z&to_date=2020-06-05T23:59:59Z
[
{
"date": "2020-06-05",
"market": "se",
"segment": "A",
"clicks": 27,
"cost": 43.2,
"currency": "SEK"
},
{
"date": "2020-06-05",
"market": "se",
"segment": "B",
"clicks": 30,
"cost": 73.5,
"currency": "SEK"
}
]

Reviews

The reviews endpoint gives you reviews, including rating and number of votes, for a given time duration.

curl -X GET -H "x-client-id: {client_id}" -H "Authorization: Bearer {token}" -H "Accept: application/json"
"https://api.schibsted.com/prisjakt/analytics/reviews/shops/{shop_id}"

[ { "market": "SE", "shop_id": 1, "date": "2020-06-05", "rating": 4, "votes": 20 }, { "market": "SE", "shop_id": 1, "date": "2020-06-05", "rating": 2, "votes": 5 } ]

Timestamps

The query parameters from_date and to_date should be timestamps following the ISO 8601 standard format yyyy-mm-ddThh:mm:ssZ as [UTC]. The return type is also ISO 8601 with format yyyy-mm-dd as UTC

Date range

The date range can be controlled with the query parameters from_date and to_date. If they are not present, the default date range is the last 30 days. You can only fetch data for a date interval of maximum 90 days. If you need to fetch more data, multiple requests are needed.

Pagination

The response could be paginated. In order to fetch the next page, use the page query parameter. The next page reference can be found in the Link header from the response. Keep in mind that you can only move forward, not backward. If there is no Link header that means there are no more pages to fetch.

HTTP/1.1 200 OK
Content-Type: text/csv; charset=utf-8
Link: <https://api.schibsted.com/prisjakt/analytics/shops/<shopId>/offers?page=asdf>; rel="next"
...

Did this answer your question?