PriceSpy Insights API

PriceSpy Insights API is the most advanced way of programmatically accessing insights data.

P
Written by Prisjakt B2B
Updated over a week ago

With PriceSpy Insights API you can access the following data for products and shops:

  • Price

  • Stock status

  • Popularity

You can access data from all PriceSpy categories associated with your PriceSpy account.

How it works

In order to use the PriceSpy Insights API, you must:

Access the API directly and build your own insights app

The base address of the API is:

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

Requests

The PriceSpy Insights 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 Insights 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 Insights API uses one format to describe an error. The error object follows RFC7807.

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

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

Authorization

All requests to the 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 -X POST \ -H "x-client-id: clientId" \ -H "accept: application/json" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=user&password=password&grant_type=password" \ https://api.schibsted.com/prisjakt/analytics/auth

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

{ "access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", "expires_in":3600, "token_type":"Bearer" }

The authorization header (Authorization) must contain the access token, and the client ID header (X-Client-Id) must contain the client ID.

$ curl -X GET \ -H "x-client-id: clientId" \ -H "Authorization: Bearer eyJhbG..." \ https://api.schibsted.com/prisjakt/insights/user

User

The /user endpoint will give you information about your user and which permissions and subscriptions you have.

$ curl -X GET \ -H "x-client-id: clientId" \ -H "Authorization: Bearer eyJhbG..." \ https://api.schibsted.com/prisjakt/insights/user
{ "email": "[email protected]", "id": "ca775c20-e3fe-4397-8de4-4dfa65ff5abd", "permissions": [ "users_subscriptions:read" ], "reports": [ { "name": "Mobile Phones", "url": "https://api.schibsted.com/reports/category-products?market=gb&category_ids=103", "market": "gb", "type": "products" } ] }

Did this answer your question?