Getting daily usage details of customers

URI - GET

To use this endpoint, send a GET request: /msp/usage/day

Request

The request includes HTTP headers (obtained in the authentication/authorization process and used to sign the request). This request must include three querystring parameters (year, month, and day). These parameters correspond to the day to return usage.

Request Headers

Header

Type

Required

Format

Description/Sample

x-av-req-id

String

Yes

UUID – generated and supplied on the request

d290f1ee-6c54-4b01-90e6-d701748f0851

x-av-token

String

Yes

Token obtained in the authentication sequence

tkn8546ffffggd9d8934593

x-av-app-id

String

Yes

Application ID provided by Avanan

myapp29

x-av-date

String

Yes

Date-time in GMT

'2016-08-29T09:12:33.001Z'

x-av-sig

String

Yes

Calculated signature

tkn8jmveolrrtertr9d8934593

Request String Parameters

Parameter

Type

Required

Format

Description/Sample

year

Integer

Yes

querystring

Year for usage

month

Integer

Yes

querystring

Month to retrieve usage

day

Integer

Yes

querystring

Day to retrieve usage

Request Body Parameters

The JSON parameters:

Parameter

Type

Required

Format

Description/Sample

scrollId

String

No

 

ID used to scroll through large sets of results.

Request sample (CURL) format

This request sample shows URI base in USA region. For URI base in other regions, see MSP Types.

Copy
curl -X GET -H "Accept: application/json" \
    -H "x-av-req-id: d290f1ee-6c54-4b01-90e6-d701748f0851" \
    -H "x-av-token: tkn8546ffffggd9d8934593" \
    -H "x-av-app-id: myapp29" \
    -H "x-av-date: 2016-08-29T09:12:33.001Z" \
    -H "x-av-sig: tkn8jmveolrrtertr9d8934593" \
    https://smart-api-production-1-us.avanan.net/v1.0/msp/usage?year=2021&month=9&day=2

Response

The response obtained from the service includes an HTTP response code and JSON formatted structure. The structure includes a responseEnvelope structure and a responseData object with an array of usage for all associated customers in the given day.

Response Structure

Copy
{
  "responseEnvelope": {
    "requestId": "string",
    "responseCode": 0,
    "responseText": "",
    "additionalText": "",
    "recordsNumber": 0,
    "scrollId": "string"
  },
  "responseData": [
    {
      "day": "string",
      "tenantDomain": "string",
      "licenseCodeName": "string",
      "users": 0,
      "dailyPrice": 0,
      "cost": 0
    }
  ]
}

Response Parameters

The response parameters:

Parameter

Type

Description

responseEnvelope

Object

A container of metadata properties

 

requestId

String

Request ID (from the request header x-av-req-id value)

 

responseCode

Integer

0 = Success

Other values = Failure

 

responseText

String

The text value of the response

 

additionalText

String

Additional information

 

recordsNumber

Integer

Number of records in the response

 

totalRecordsNumber

Integer

Total number of records

 

scrollId

String

A unique ID used to scroll through data

responseData

 

Object

Usage List - Array of usage

responseData/UsageList

 

day

String

Day of usage in DateTime format

 

tenantDomain

String

TLD of the Avanan tenant

 

licenseCodeName

String

Code name of the license for the tenant on the day of usage

 

users

Integer

User count for the usage day

 

dailyPrice

Float

Price for the day per user

 

cost

Float

Cost for all users of the tenant per day

Response Sample

A valid response from the service:

Copy
{
  "responseEnvelope": {
        "requestId": "cc7796ac-6235-4a06-b7e9-6abc557976f6",
        "responseCode": 204,
        "responseText": "",
        "additionalText": "",
        "recordsNumber": 1,
        "scrollId": ""
  },
  "responseData": [
    {
        'day': '2021-09-02',
        'tenantDomain': “abccompany”,
        'licenseCodeName': 'full_suite_protection',
        'users': 45,
        'dailyPrice': 0.069,
        'cost': 3.11
    }
  ]
}