Insight

GET /kpis

Requires authentication with server access token.

Get KPIs in this client.

The KPI tallies are generated at 5:00 AM every morning. A KPI created 2012-12-12 contains all data up to 2012-12-12 05:00:00. We cannot guarantee there is a KPI generated for every date, since the cronjob might be stopped due to deployment.

Available KPIs

Name Description
users_registered Number of registered user with connection to client
users_verified Number of verified users with connection to client
users_using_facebook Number of users with Facebook connection and connection to client
users_using_google Number of users with Google connection and connection to client
users_using_live Number of users with Windows Live connection and connection to client
logins Number of logins
completed_orders Number of orders with status complete
completed_orders_with_creditcard Number of orders with status complete, performed with credit card
completed_orders_with_invoice Number of orders with status complete, performed with invoice
completed_orders_with_sms Number of orders with status complete, performed with SMS
sum_completed_orders Sum of price of orders, matching same critera as above
sum_completed_orders_with_creditcard Sum of price of orders, matching same critera as above
sum_completed_orders_with_invoice Sum of price of orders, matching same critera as above
sum_completed_orders_with_sms Sum of price of orders, matching same critera as above
total_active_subscriptions Number of active subscriptions
total_active_subscriptions_autorenew_on Number of active subscriptions, auto renew turned on
total_active_subscriptions_autorenew_off Number of active subscriptions, auto renew turned off
total_churned_subscriptions Number of churned subscriptions
actively_churned_subscriptions Number of actively churned subscriptions
passively_churned_subscriptions Number of passively churned subscriptions
api_churned_subscriptions Number of churned subscriptions through API (ie Ambassador)
force_churned_subscriptions Number of forced churned subscriptions
deleted_account_churned_subscriptions Number of churned subscriptions, due to account deletion
final_churned_subscriptions Number of churned subscriptions, due to final end date reached
renewed_subscriptions Number of renewed subscriptions
paused_subscriptions Number of paused subscriptions
expiration_changed_subscriptions Number of subscriptions where expiration date changed

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/kpis

name

optional

The name of one or more KPIs to query for, comma-separated. See the list of available KPIs above.

sort

optional

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

Example request

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

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

This example is an excerpt, see a full example

PHP
Minimal example
<?php
$client->auth();
echo var_dump($client->api("/kpis"));
With all parameters
<?php
$params = array(
    "name" => "John Doe",
    "sort" => "userId"
);

$client->auth();
echo var_dump($client->api("/kpis", $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 "/kpis"))
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 "/kpis" {"name" "John Doe"
                                  "sort" "userId"}))

Response

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

Success: 200 OK

A list of KeyPerformanceIndicator objects

KPI

name

string

The KPI (see the table above)

value

integer (as string)

The KPI value count

created

datetime

When the KPI was created

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.
  • 404 Not Found No KPI by this name
  • 420 Request Ratelimit exceeded

Sample response

JSON
[]
JSON-P
callback([]);

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.