Payment Services

GET /digitalcontents

Requires authentication with server access token.

Digital content is represented by static products that are not restricted in time, or renewed by SPiD. Clients may grant and revoke digital content access for user's through the API. Digital contents can also be connected to a payment agreement, allowing clients to use their own recurring logic.

See also

Help us improve

Did you spot an error? Or maybe you just have a suggestion for how we can improve? Leave us a comment.

Request

GET /api/2/digitalcontents

sort

optional

userId

optional

Limit results to digital content purchased by this user.

status

optional

Limit results to digital content with this status.

productId

optional

Limit results to digital content for this product.

parentProductId

optional

Limit results to digital content for this product and its child products.

filters

optional
updated
Filter by recently updated items, order by last updated (should be used with since & until)
expired
Return all items with status expired
active
Filter by items with status active
all
Include all items in the response, including deleted/blocked or otherwise excluded items
none
Do not apply any status filters (e.g. same as 'all')

The pagination parameters limit, offset, since, and until are also supported.

Example request

cURL
Minimal example
curl https://login.schibsted.com/api/2/digitalcontents -G \
   -d "oauth_token=[access token]"
With all parameters
curl https://login.schibsted.com/api/2/digitalcontents -G \
   -d "oauth_token=[access token]" \
   -d "sort=userId" \
   -d "userId=42" \
   -d "status=0" \
   -d "productId=1337" \
   -d "parentProductId=44"
Java
Minimal example
SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    GET(token, "/digitalcontents").
    getResponseBody();
With all parameters
Map<String, String> params = new HashMap<>() {{
    put("sort", "userId");,
    put("userId", "42");,
    put("status", "0");,
    put("productId", "1337");,
    put("parentProductId", "44");
}};

SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    GET(token, "/digitalcontents", params).
    getResponseBody();

This example is an excerpt, see a full example

PHP
Minimal example
<?php
$client->auth();
echo var_dump($client->api("/digitalcontents"));
With all parameters
<?php
$params = array(
    "sort" => "userId",
    "userId" => "42",
    "status" => "0",
    "productId" => "1337",
    "parentProductId" => "44"
);

$client->auth();
echo var_dump($client->api("/digitalcontents", $params));

This example is an excerpt, see a full example

Clojure
Minimal example
(ns example
  (:require [spid-client-clojure.core :as spid]))

(let [client (spid/create-client "[client-id]" "[secret]")
      token (spid/create-server-token client)]
  (spid/GET client token "/digitalcontents"))
With all parameters
(ns example
  (:require [spid-client-clojure.core :as spid]))

(let [client (spid/create-client "[client-id]" "[secret]")
      token (spid/create-server-token client)]
  (spid/GET client token "/digitalcontents" {"sort" "userId"
                                             "userId" "42"
                                             "status" "0"
                                             "productId" "1337"
                                             "parentProductId" "44"}))

Response

This endpoint supports the JSON and JSON-P response formats.

Success: 200 OK

A list of DigitalContent objects.

Digital content

userProductId

integer (as string)

productId

integer (as string)

parentProductId

integer (as string)

clientId

string

userId

integer (as string)

orderId

integer (as string)

status

integer (as string)

count

integer (as string)

updated

datetime

When the digital content was last updated

created

datetime

When the digital content was created

bundleId

integer (as string)

statusMsg

string

The check mark indicates that the field always contains a valid non-empty value.

Failure cases

Some HTTP response codes are used for multiple error situations. There is no consistent way to tell these apart, but the error object will contain a textual explanation of the reason for the error. For explanation on OAuth related failures and errors see OAuth authentication failures.

  • 401 Unauthorized You don't have administration rights for this client.
  • 401 Unauthorized Your client doesn't have administration rights for this client.
  • 403 Forbidden Client is not authorized to access this API endpoint. Contact SPiD to request access.
  • 403 Forbidden Requesting IP is not whitelisted
  • 403 Forbidden Access token rejected
  • 404 Not Found Unknown client ID
  • 404 Not Found Client ID mismatch. The client making the request is no the owner of this resource, and does not have administrative privileges for it.
  • 420 Request Ratelimit exceeded

Sample response

JSON
[
    {
        "userProductId": "2",
        "productId": "10162",
        "parentProductId": "0",
        "clientId": "4e8463569caf7ca019000007",
        "userId": "100003",
        "orderId": "673",
        "status": "3",
        "count": "1",
        "updated": "2013-04-29 21:34:47",
        "created": "2013-04-29 21:34:47"
    },
    {
        "userProductId": "1",
        "productId": "10152",
        "parentProductId": "0",
        "clientId": "4e8463569caf7ca019000007",
        "userId": "100003",
        "orderId": "672",
        "status": "3",
        "count": "1",
        "updated": "2013-04-29 19:40:51",
        "created": "2013-04-29 19:40:51"
    }
]
JSON-P
callback([
    {
        "userProductId": "2",
        "productId": "10162",
        "parentProductId": "0",
        "clientId": "4e8463569caf7ca019000007",
        "userId": "100003",
        "orderId": "673",
        "status": "3",
        "count": "1",
        "updated": "2013-04-29 21:34:47",
        "created": "2013-04-29 21:34:47"
    },
    {
        "userProductId": "1",
        "productId": "10152",
        "parentProductId": "0",
        "clientId": "4e8463569caf7ca019000007",
        "userId": "100003",
        "orderId": "672",
        "status": "3",
        "count": "1",
        "updated": "2013-04-29 19:40:51",
        "created": "2013-04-29 19:40:51"
    }
]);

Comments/feedback

Do you have questions, or just want to contribute some newly gained insight? Want to share an example? Please leave a comment. SPiD reads and responds to every question. Additionally, your experience can help others using SPiD, and it can help us continuously improve our documentation.