Prisjakt API¶
This is a RESTful api, meaning we use the standard GET, POST, PUT and DELETE verbs.
We currently support only JSON (we can enable more if you have a need for it)
We use OAuth2
We use UTF-8 encoding for everything.
Order of items is always the same as the order you requested.
Order of fields can change at any time, always use index.
Fields can be
null
, your code should be able to handle it without crashing.Specific times are represented as UNIX timestamps.
Dates are represented as strings with the format
YYYY-MM-DD
, as defined by ISO 8601. April 3rd, 2012 is represented as “2012-04-03”.We encourage you to respect data types. If you see numeric id’s represented as strings, they can probably have non numerical values.
On various endpoints there are filters available (se Explorer).
You can specify which Fields you want.
- We use a minimal implementation approach.
- We did not build things that we did not need.Do you require functionality that is not there?Make a request, we will most likely add anything reasonable.
Responses¶
Standard response will contain 2 indexes.
items - contains the items you requested
meta - contains information about Paging and Sorting as well as other metadata like property definitions.
it will look like this
{
"meta": {},
"items": []
}
If your request contains multiple resources the items
index will be
replaced by resources
.
it will look like this
{
"meta": {},
"resources": {
"products": {
"meta": {},
"items": []
},
"stores": {
"meta": {},
"items": []
}
}
}
If an error occurs, the response will have a non-200 HTTP status
code and the response will only contain the index error
.
it will look something like this
{
"error": {
"code": "http.400",
"message": "Hey dev, there is an error with the parameter",
"user_message": "Stay calm",
"see_more": "http://dev.prisjakt.nu/doc/..."
}
}
user_message
is not always available.
Supressing response codes¶
You can force the API to always return 200 OK
HTTP status code by
appending suppress_response_codes=true
to the API call. If this is
used, the actual is added to the response as http_status_code
.
If a call to /products/1234
normally responds with
HTTP status code: 404 Not Found
Response data:
{
"error": {
"code": "item.not-found",
"message": "Item with id 1234 was not found",
"user_message": null,
"see_more": "http://dev.prisjakt.nu/doc/..."
}
}
a call to /products/1234?suppress_response_codes=true
will respond
with
HTTP status code: 200
Response data:
{
"error": {
"code": "item.not-found",
"message": "Item with id 1234 was not found",
"user_message": null,
"see_more": "http://dev.prisjakt.nu/doc/..."
},
"http_status_code": 404
}