Billing Center API v1.0 Resources

API Summary

Operation Method Endpoint
Contract Usage
Report on Contract Usage (CSV) POST /billing-usage/v1/contractUsageData/csv
Report on Contract Usage GET /billing-usage/v1/contractUsageData/{productId}/{reportSourceType}/{reportSourceId}/{statisticType}/{month}/{year}
Report on Monthly Usage GET /billing-usage/v1/contractUsageData/monthly/{productId}/{reportSourceType}/{reportSourceId}/{statisticType}/{startMonth}/{startYear}/{endMonth}/{endYear}
List CP Codes GET /billing-usage/v1/cpcodes/{reportSourceType}/{reportSourceId}/{month}/{year}
List Measures GET /billing-usage/v1/measures/{productId}/{reportSourceType}/{reportSourceId}/{startMonth}/{startYear}/{endMonth}/{endYear}
List Products POST /billing-usage/v1/products
List Report Sources GET /billing-usage/v1/reportSources
List Statistic Types GET /billing-usage/v1/statisticTypes/{productId}/{reportSourceType}/{reportSourceId}/{startMonth}/{startYear}/{endMonth}/{endYear}
Contract Usage Resellers
Report Reseller Contract Usage POST /billing-usage/v1/reseller/contractUsageData/csv
List Reseller Report Sources GET /billing-usage/v1/reseller/reportSources

Report on Contract Usage (CSV)

Creates a CSV report with contract usage data for the given parameters. For more information on CSV reports please refer to CSV Format Overview.

POST /billing-usage/v1/contractUsageData/csv

Content-Type: application/x-www-form-urlencoded

Request:

reportSources=reportSources%3D%5B%7B%22id%22%3A%20%221-123456%22%2C%20%22type%22%3A%20%22contract%22%7D%2C%20%7B%22id%22%3A%20%221234%22%2C%20%22type%22%3A%20%22reportGroup%22%7D%5D%26startDate%3D%7B%22month%22%3A11%2C%20%22year%22%3A%202011%7D%26endDate%3D%7B%22month%22%3A11%2C%20%22year%22%3A%202011%7D%26products%3D%5B%7B%22id%22%3A%20%22Q-12345%22%7D%2C%20%7B%22id%22%3A%20%22Q-12345%22%7D%5D

Status 200 text/csv

Headers:

  • Content-Type: text/csv;charset=UTF-8
  • Content-decomposition: attachment; fileName=usage_20130709141439.csv
  • Transfer-Encoding: chunked

Response:

Version:,1.0
Report Title:,Contract Usage Report
Report Start Date:,02/01/2014
Report End Date:,02/28/2014
TimeZone:,GMT (+0)
Expired HTTP Content Delivery - 1-ENCYF,Data Not Final
Contract / Reporting Group:,Usage Start Date,Usage End Date,Product,CP Codes,TimeStamp,95/5 GB,Total MB
Expired HTTP Content Delivery - 1-ENCYF,02/01/2014,02/04/2014,\"NetStorage\",1337,02/01/2014,0.29,0.77
Expired HTTP Content Delivery - 1-ENCYF,02/02/2014,02/04/2014,\"NetStorage\",1337,02/02/2014,0.49,0.73
Expired HTTP Content Delivery - 1-ENCYF,02/03/2014,02/04/2014,\"NetStorage\",1337,02/03/2014,0.99,0.19
Expired HTTP Content Delivery - 1-ENCYF,02/04/2014,02/04/2014,\"NetStorage\",1337,02/04/2014,0.76,0.26

Relevant data members:

Member Type Description
Required
endDate String Define the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.
products String Should contain a list of products in JSON format. The product IDs can be retrieved using the products service.
reportSources String Should contain a list of report sources in JSON format. The report source ids can be retrieved using the reportSources service.
startDate String Define the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.

Report on Contract Usage

This method returns the contract usage values for the specified parameters. The data is split into two possible series: FinalDataMap and NonFinalDataMap, which hold final and non-final values accordingly. Each series contains a list of (day, value) pairs, where value is the contract usage value for the day of the month. The response also contains some technical information which is used by the Luna Contract Usage Reports application and can be ignored.

GET /billing-usage/v1/contractUsageData/{productId}/{reportSourceType}/{reportSourceId}/{statisticType}/{month}/{year}

Example: /billing-usage/v1/contractUsageData/1-ABC012/contract/15929/OTUvNSBNQlBT/12/2015

Parameter Type Sample Description
Required
month Number 12 The month from 1 to 12 to fetch data for.
productId String 1-ABC012 The ID of the product.
reportSourceId String 15929 The report source ID, as returned by the reportSources service.
reportSourceType String contract The report source type, as returned by the reportSources service.
statisticType String OTUvNSBNQlBT The statistic type identifier, as provided by the statisticTypes service.
year Number 2015 The year we want to fetch data for.

Status 200 application/json

Response:

{
     "status": "ok",
     "contents": {
         "title": "",
         "categories": "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31",
         "series": [
             {
                 "name": "NonFinalData",
                 "color": "#f36b28",
                 "values": {
                    "1": 13.39,
                    "2": 35.59,
                    "3": 59.584,
                    "4": 81.368,
                    "5": 97.119,
                    "6": 104.47,
                    "7": 124.338,
                    "8": 143.238,
                    "9": 163.415,
                    "10": 222.385,
                    "11": 247.204,
                    "12": 275.131,
                    "13": 293.759,
                    "14": 307.987,
                    "15": 342.186,
                    "16": 366.525,
                    "17": 381.929,
                    "18": 400.502,
                    "19": 419.108,
                    "20": 644.331,
                    "21": 661.764,
                    "22": 678.774,
                    "23": 693.848,
                    "24": 712.568,
                    "25": 726.205,
                    "26": 742.338,
                    "27": 765.065,
                    "28": 821.818,
                    "29": 854.806,
                    "30": 881.275,
                    "31": null
                 },
                 "orderedValues": "[13.39,35.59,59.584,81.368,97.119,104.47,124.338,143.238,163.415,222.385,247.204,275.131,293.759,307.987,342.186,366.525,381.929,400.502,419.108,644.331,661.764,678.774,693.848,712.568,726.205,742.338,765.065,821.818,854.806,881.275,0]"
             }
         ],
         "labels": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" ]
     }
 }

Relevant data members:

Member Type Description
Required
series String An array containing a list of series (FinalDataMap or NonFinalDataMap).
values String A list of days in the month and their corresponding contract usage values. If a value is null, it means that no value is available for this particular day.

Report on Monthly Usage

This method returns the contract usage values for the specified parameters, which are grouped by month.

GET /billing-usage/v1/contractUsageData/monthly/{productId}/{reportSourceType}/{reportSourceId}/{statisticType}/{startMonth}/{startYear}/{endMonth}/{endYear}

Example: /billing-usage/v1/contractUsageData/monthly/1-ABC012/contract/15929/OTUvNSBNQlBT/6/2015/12/2016

Parameter Type Sample Description
Required
endMonth Number 12 The last month we want to fetch data for.
endYear Number 2016 The last year we want to fetch data for.
productId String 1-ABC012 The ID of the product.
reportSourceId String 15929 The report source ID, as returned by the reportSources service.
reportSourceType String contract The report source type, as returned by the reportSources service.
startMonth Number 6 The first month we want to fetch data for.
startYear Number 2015 The first year we want to fetch data for.
statisticType String OTUvNSBNQlBT The statistic type identifier, as provided by the statisticTypes service.

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": {
        "categories": "03/2013",
        "labels": [ "03/2013" ],
        "legend": [
            {
                "color": "#6d869f",
                "name": "FinalData"
            },
            {
                "color": "#f36b28",
                "name": "NonFinalData"
            }
        ],
        "series": [
            {
                "color": null,
                "name": "Contract_0",
                "orderedValues": "[97433.684]",
                "values": {
                    "03/2013": {
                        "color": "#f36b28",
                        "y": 97433.684
                    }
                }
            },
            {
                "color": null,
                "name": "Contract_1",
                "orderedValues": "[98073.031]",
                "values": {
                    "03/2013": {
                        "color": "#6d869f",
                        "y": 98073.031
                    }
                }
            },
            {
                "color": null,
                "name": "Contract_2",
                "orderedValues": "[98763.23]",
                "values": {
                    "03/2013": {
                        "color": "#f36b28",
                        "y": 98763.23
                    }
                }
            },
            {
                "color": null,
                "name": "Contract_3",
                "orderedValues": "[99573.921]",
                "values": {
                    "03/2013": {
                        "color": "#6d869f",
                        "y": 99573.921
                    }
                }
            }
        ],
        "title": "",
        "xunit": "",
        "yunit": ""
    }
}

Relevant data members:

Member Type Description
Required
categories String Month and year
labels String Data labels
legend String Color definitions for final and non-final data series
series String An array containing a list of series. Each entry includes name, color, orderedValues and values. There are color and y values defined in values.
title String Title
values String A list of months and their corresponding contract usage values. If a value is null, it means that no value is available for this particular month.
Optional
xunit Number Optional. Measurement units for the X axis.
yunit Number Optional. Measurement units for the Y axis.

List CP Codes

This method returns a list of CP codes that are available in the given report source in the given time span. If there is no report data for the given selection, no cp codes will be returned even if the report source has CP codes defined in a different time span.

GET /billing-usage/v1/cpcodes/{reportSourceType}/{reportSourceId}/{month}/{year}

Example: /billing-usage/v1/cpcodes/contract/15929/12/2015

Parameter Type Sample Description
Required
month Number 12 The month from 1 to 12 to fetch data for.
reportSourceId String 15929 The report source ID, as returned by the reportSources service.
reportSourceType String contract The report source type, as returned by the reportSources service.
year Number 2015 The year we want to fetch data for.

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {
            "code": 1234,
            "description": "Cp code description"
        },
        {
            "code": 2345,
            "description": "Cp code description"
        }
    ]
}

Relevant data members:

Member Type Description
Required
code String The CP code.
description String CP code description

List Measures

This method returns the measures that are available for the given product and report group in the current account context. A measure value is an aggregate of values for a specified statistic type (e.g., MBits) in the selected month. Usually the aggregation is performed by summing up all values. For some measures the maximum value is taken (Total Hits, Peak Mbps, etc.). For some statistic types it is impossible to calculate a measure (e.g., 95/5). These statistic types are ignored and not returned by this service.

GET /billing-usage/v1/measures/{productId}/{reportSourceType}/{reportSourceId}/{startMonth}/{startYear}/{endMonth}/{endYear}

Example: /billing-usage/v1/measures/1-ABC012/contract/15929/6/2015/12/2016

Parameter Type Sample Description
Required
endMonth Number 12 The last month we want to fetch data for.
endYear Number 2016 The last year we want to fetch data for.
productId String 1-ABC012 The ID of the product.
reportSourceId String 15929 The report source ID, as returned by the reportSources service.
reportSourceType String contract The report source type, as returned by the reportSources service.
startMonth Number 6 The first month we want to fetch data for.
startYear Number 2015 The first year we want to fetch data for.

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {
            "billingDay": 31,
            "measures": [
                {
                    "chartAvailable": true,
                    "name": "95/5 Mbps",
                    "statisticType": "OTUvNSBNQlBT",
                    "unit": "Mbps",
                    "value": 0.012
                },
                {
                    "chartAvailable": false,
                    "name": "Peak Mbps",
                    "statisticType": "UEVBSyBNQlBT",
                    "unit": "Mbps",
                    "value": 0.431
                },
                {
                    "chartAvailable": false,
                    "name": "Total Hits",
                    "statisticType": "VE9UQUwgSElUUw==",
                    "unit": "Hits",
                    "value": 21900
                },
                {
                    "chartAvailable": true,
                    "name": "Total MB",
                    "statisticType": "VE9UQUwgTUI=",
                    "unit": "MB",
                    "value": 923.862
                }
            ]
        }
    ]
}

Relevant data members:

Member Type Description
Required
chartAvailable String Indicates whether a chart can be generated for this measure (used by the Luna Contract Usage Reports application).
measures String An array containing a billingDay property and a list of corresponding measures. The billing day defines the last day of the billing period for which the measures were calculated.
name String The human readable name of the statistic type.
statisticType String The statistic type identifier as returned by the statisticTypes services.
unit String The unit of measurement for the statistic measure.
value String The calculated measure value.

List Products

Gets all products that are available for the given report source in the provided time span. Only products that have report data available for the provided arguments will be returned.

POST /billing-usage/v1/products

Content-Type: application/x-www-form-urlencoded

Request:

reportSources=%5B%7B%22id%22%3A%2215929%22%2C%22type%22%3A%22reportGroup%22%7D%2C%7B%22id%22%3A%224352%22%2C%22type%22%3A%22reportGroup%22%7D%2C%7B%22id%22%3A%227471%22%2C%22type%22%3A%22reportGroup%22%7D%5D&startDate=%7B%22month%22%3A11%2C+%22year%22%3A+2011%7D&endDate=%7B%22month%22%3A11%2C+%22year%22%3A+2013%7D

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {"id":"1-1MT2CP","name":"Akamai FTP"},
        {"id":"1-39UFVI","name":"Akamai Media Delivery - Streaming for Flash"},
        {"id":"1-39UFW5","name":"Akamai Media Delivery - Standard Downloads"},
        {"id":"1-39UMI1","name":"Akamai Media Delivery - Streaming"},
        {"id":"1-DGDD8","name":"Storage"},
        {"id":"1-DGDF7","name":"Log Delivery (FF)"},
        {"id":"1-Y9R1G","name":"Tiered Distribution Delivery"},
        {"id":"B-3-2ORSUU","name":"On Demand and Live Flash"},
        {"id":"B-3-8D05LS","name":"Adobe Flash Platform"},
        {"id":"B-3-8ZFW1F","name":"Akamai Media Delivery - Streaming for Flash"},
        {"id":"B-3-92QNMT","name":"Log Delivery Service - All Streaming Delivery"},
        {"id":"B-3-A5MBD","name":"Dynamic Site Delivery"},
        {"id":"B-3-A5MED","name":"NetStorage"},
        {"id":"B-3-FX2U1","name":"Secure Delivery"},
        {"id":"B-3-FX2YW","name":"Live Flash"},
        {"id":"B-4-1LO3SZ","name":"Live Flash"},
        {"id":"B-4-1O78TS","name":"All Streaming Delivery"},
        {"id":"M-LC-1151","name":"SecureHD Media Encryption"},
        {"id":"M-LC-959","name":"HD Live Streaming for iPhone & iPad"}
]}

The parameters from the request example in decoded form:

reportSources=[{"id":"15929","type":"reportGroup"},{"id":"4352","type":"reportGroup"},{"id":"7471","type":"reportGroup"}]
startDate={"month":11, "year": 2011}
endDate={"month":11, "year": 2013}

Relevant data members:

Member Type Description
Required
endDate String Define the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.
reportSources String Should contain a list of report sources in JSON format.
startDate String Define the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.

List Report Sources

Gets all Report Sources for the user account. Report sources are used to limit the scope of returned contract usage data.

GET /billing-usage/v1/reportSources

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {
            "id": "1-23456",
            "name": "Top-Level Group: 1-23456",
            "type": "contract"
        },
        {
            "id": "1-56DI96",
            "name": "Windows Media Streaming - 1-23456",
            "type": "contract"
        },
        {
            "id": "11111",
            "name": "My Group",
            "type": "reportGroup"
        }
    ]
}

List Statistic Types

Gets a list of statistic types that are valid for the given product in the provided timespan.

GET /billing-usage/v1/statisticTypes/{productId}/{reportSourceType}/{reportSourceId}/{startMonth}/{startYear}/{endMonth}/{endYear}

Example: /billing-usage/v1/statisticTypes/1-ABC012/contract/15929/6/2015/12/2016

Parameter Type Sample Description
Required
endMonth Number 12 The last month we want to fetch data for.
endYear Number 2016 The last year we want to fetch data for.
productId String 1-ABC012 The ID of the product.
reportSourceId String 15929 The report source ID, as returned by the reportSources service.
reportSourceType String contract The report source type, as returned by the reportSources service.
startMonth Number 6 The first month we want to fetch data for.
startYear Number 2015 The first year we want to fetch data for.

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {
            "chartUnit": "Mbps",
            "statisticLabel": "95/5 Mbps",
            "statisticType": "OTUvNSBNQlBT"
        },
        {
            "chartUnit": "MB",
            "statisticLabel": "Total MB",
            "statisticType": "VE9UQUwgTUI="
        }
    ]
}

Relevant data members:

Member Type Description
Required
chartUnit String The unit of measurement of the statistic type.
statisticLabel string, required, 95/5 Mbps The human-readable name of the statistic type.
statisticType string, required, OTUvNSBNQlBT The identifier that should be used to retrieve contract usage data for this statistic type.

Report Reseller Contract Usage

Creates a CSV report with contract usage data for the given report sources and time span. The CSV report includes all products which meet the specified criteria. For more information on CSV reports please refer to CSV Format Overview.

POST /billing-usage/v1/reseller/contractUsageData/csv

Content-Type: application/x-www-form-urlencoded

Request:

reportSources=%3D%5B%7B%22id%22%3A%20%221-123456%22%2C%20%22type%22%3A%20%22contract%22%7D%2C%20%7B%22id%22%3A%20%221234%22%2C%20%22type%22%3A%20%22reportGroup%22%7D%5D%26startDate%3D%7B%22month%22%3A11%2C%20%22year%22%3A%202011%7D%26endDate%3D%7B%22month%22%3A11%2C%20%22year%22%3A%202011%7D%26products%3D%5B%7B%22id%22%3A%20%22Q-12345%22%7D%2C%20%7B%22id%22%3A%20%22Q-12345%22%7D%5D

Status 200 text/csv

Headers:

  • Content-Type: text/csv;charset=UTF-8
  • Content-decomposition: attachment; fileName=usage_20130709141439.csv
  • Transfer-Encoding: chunked

Response:

Version:,1.0
Report Title:,Contract Usage Report
Report Start Date:,02/01/2014
Report End Date:,02/28/2014
TimeZone:,GMT (+0)
Expired HTTP Content Delivery - 1-ENCYF,Data Not Final
Contract / Reporting Group:,Usage Start Date,Usage End Date,Product,CP Codes,TimeStamp,95/5 GB,Total MB
Expired HTTP Content Delivery - 1-ENCYF,02/01/2014,02/04/2014,\"NetStorage\",1337,02/01/2014,0.29,0.77
Expired HTTP Content Delivery - 1-ENCYF,02/02/2014,02/04/2014,\"NetStorage\",1337,02/02/2014,0.49,0.73
Expired HTTP Content Delivery - 1-ENCYF,02/03/2014,02/04/2014,\"NetStorage\",1337,02/03/2014,0.99,0.19
Expired HTTP Content Delivery - 1-ENCYF,02/04/2014,02/04/2014,\"NetStorage\",1337,02/04/2014,0.76,0.26

Decoded form of the example request:

reportSources=[{"id": "1-123456", "type": "contract"}, {"id": "1234", "type": "reportGroup"}]&
startDate={"month":11, "year": 2011}&
endDate={"month":11, "year": 2011}&
products=[{"id": "Q-12345"}, {"id": "Q-12345"}]

Relevant data members:

Member Type Description
Required
endDate String defines the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.
reportSources String should contain a list of report sources in JSON format. The report source idscan be retrieved using the reportSources service.
startDate String defines the time span products will be returned for. If products for one month should be returned, startDate should be equal endDate.

List Reseller Report Sources

Gets all Report Sources the user has access to. Report sources are used to limit the scope of returned contract usage data.

GET /billing-usage/v1/reseller/reportSources

Status 200 application/json

Response:

{
    "status": "ok",
    "contents": [
        {
            "id": "1-23456",
            "name": "Top-Level Group: 1-23456",
            "type": "contract"
        },
        {
            "id": "1-56DI96",
            "name": "Windows Media Streaming - 1-23456",
            "type": "contract"
        },
        {
            "id": "11111",
            "name": "My Group",
            "type": "reportGroup"
        }
    ]
}

Last modified: 12/12/2016