User Tools

Site Tools


api:customer:customer-subscriptions

API : CustomerSubscriptions List

Introduction

This request will return all the subscriptions for either a given a customer, or a reseller. The reseller subscriptions is a summary of all of their customers' subscriptions.

For customers, all subscriptions are grouped per product, so the overview will show Product X, its cost and price, and how many “subscribers”/accounts that use this product.

For resellers, the grouping works similarly, but it goes a level beyond that, and groups all products on their reseller product, then showing per-customer usage under each product.

Request

URL https://api.telecomx.dk/customer/subscriptions
Method GET
Access level VIEWER, MANAGER or OWNER if user belongs to the customer.
RESELLER if customer belongs to the reseller or a sub reseller.
RESELLER_ADMIN.
ADMIN.
Query customer [optional] Id of the customer (24 hex-char string). RESELLER and up only - other users always get their own customer.
reseller Id of the reseller. If given, it will show a reseller view instead of customer view (thus overruling the customer query parameter). RESELLER and up
format [optional] Either csv or json (lowercase). Defaults to json. Only used in the reseller view - the customer view always returns JSON.

Query example

https://api.telecomx.dk/customer/subscriptions?customer=1234567890ABCDEF12345678
https://api.telecomx.dk/customer/subscriptions?customer=1234567890ABCDEF12345678&format=csv
https://api.telecomx.dk/customer/subscriptions?reseller=8211399890BBBDEF12345178
https://api.telecomx.dk/customer/subscriptions?reseller=8211399890BBBDEF12345178&format=csv

Response

Array of the following JSON objects
matchingProduct Object Product object, containing normal product properties (see API : Product Get)
name String Name of the grouped product
subscriptions Array Contains array of each subscription/account
subscriptions[].customer ObjectId Customer ID
subscriptions[].name String Product name if customer overview, customer name if reseller overview
subscriptions[].sumPrice Number (decimal) The price of these subscriptions
subscriptions[].sumWholesale Number (decimal) The wholesale price of these subscriptions
subscriptions[].units Number (integer) The amount of these subscriptions
accountType String The type of account
sumPrice Number (decimal) Sum price of all subscriptions
sumWholesale Number (decimal) Sum wholesale of all subscriptions
units Number (integer) Amount of subscriptions/units

Note that properties holding no value may be omitted from the object.

With format=csv (reseller view only) the response is a text/csv attachment with the columns: Productkode;Produktnavn;Antal;Forhandlerpris;Pris.

Example

[
  {
    "matchingProduct": { "_id": "650000000000000000000401", "name": "Number rent", "productCode": "NR-1" },
    "name": "Number rent",
    "accountType": "NUMBER",
    "sumPrice": 456.45,
    "sumWholesale": 370.2,
    "units": 21,
    "subscriptions": [
      { "customer": "650000000000000000000101", "name": "Example Company East", "sumPrice": 200, "sumWholesale": 100, "units": 20 },
      { "customer": "650000000000000000000102", "name": "Example Company North", "sumPrice": 256.45, "sumWholesale": 270.2, "units": 1 }
    ]
  }
]

Errors

Error code Message Description
404 reseller Reseller not found
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/customer/customer-subscriptions.txt · Last modified: by Mikkel Meerwaldt Jørgensen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki