ArtPortalen exposes some of its data through a REST API. This API provides access for the resources described below. The API supports both XML and JSON formats.
The API has two parts. One part is public, the other requires authentication and SSL. For all calls made to the API, public or non-public, an access-key is required.
Access-key are sent in the HTTP Header, ex: request.Headers.Add("access-key", "yourPersonalAcessKey");
Authentication for the non-public part of the API is done using your regular login/password via HTTP Basic authentication.
http://en.wikipedia.org/wiki/Basic_access_authentication
When making an API call to URL [address]/token with login/pwd and access-key the server response is a unique "token".
The "token" returned may be used in following calls to the API in order to avoid a new login for every request.
A "token" is valid for a certain amount of time. When it expires the client has to request a new one by sending authentication information.
To send the unique token use "Authorization: Session " + [token] in the HTTP header.
HTTP Header example:
Content-Type: application/json
Authorization: Session eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
access-key: 1234518f8c284000832512383d2d353
[Unique token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"] received from a request to [address]/token.
[access-key: "1234518f8c284000832512383d2d353"] received from ArtPortalen when register. (see below)
The api implements HTTP access control - CORS. https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS If you want to access the API via javascript, you need to provide the domains to which ArtPortalen should grant access.
When creating a remote element, the Content-Type of the request must be specified:
Look at http://test-api.artportalen.se. We have a basic example of an implementation there.
To be granted access you need:
Following are the HTTP response codes our API may return.