Tutorials: Usage service

The tutorials in this section show you how to perform various tasks within the usage service:

The tutorials in this section show you how to perform various tasks within the usage service.

Note

For all the tutorials in this section, the usage API requires a realmId in each query.

Get usage by realm, feature, project, app

The usage API allows you to query usage by realm, feature, project, and app. To access the usage API, you must create an app and credentials. See OAuth token documentation for additional details.

Get usage by realmId

As shown in the following, you can retrieve your usage by using your realmId. This tutorial uses org123456789 as the realmId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51

Get usage by featureId

As shown in the following, you can use a featureId to get your usage amount. This tutorial uses hrn:here:service::org123456789:search-geocoding-1 as the featureId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&featureId=hrn%3Ahere%3Aservice%3A%3Aorg123456789%3Asearch-geocoding-1

Get usage by projectHrn

As shown in the following, you can use the projectHrn to get your usage amount. This tutorial uses hrn:here:authorization::myrealm:project/my-project-0000 as the projectHrn.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&projectHrn=hrn%3Ahere%3Aauthorization%3A%3Amyrealm%3Aproject%2Fmy-project-0000

Get usage by appId

As shown in the following, you can use the appId to retrieve your usage amount. This tutorial uses j1dasda012edasfgne as the appId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&appId=j1dasda012edasfgne

Get usage by billingTag

As shown in the following, you can use the billingTag to get your usage amount. This tutorial uses testtag as the billingTag.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&billingTag=testtag

Response: HTTP 200 OK

{
    "total": 2,
    "limit": 100,
    "items": [
        {
            "realmId": "org123456789",
            "featureId": "hrn:here:service::org123456789:feature1",
            "category": "Location Services",
            "name": "Autocomplete",
            "valueDriver": "Transactions",
            "usageValue": 144940.0000,
            "billableValue": 144940.0000
        },
        {
            "realmId": "org123456789",
            "featureId": "hrn:here:service::org123456789:feature2",
            "category": "Location Services",
            "name": "Geocode & Reverse Geocode",
            "valueDriver": "Transactions",
            "usageValue": 91932.0000,
            "billableValue": 91932.0000
        }
    ],
    "nextOffset": 0,
    "lastOffset": 0
}

For additional details, see Get usage by realm.

Get usage csv by realm, feature, project, app

The usage API allows you to query usage csv by realm, feature, project, and app. To access the usage API, you must create an app and credentials. See OAuth tokens documentation for additional details.

Get usage csv by realmId

As shown in the following, you can retrieve the usage csv by using the realmId. This tutorial xample uses org123456789 as the realmId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789/csv?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51

Get usage csv by featureId

As shown in the following, you can retrieve the usage csv by using the featureId. This tutorial uses hrn:here:service::org123456789:search-geocoding-1 as the featureId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789/csv?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&featureId=hrn%3Ahere%3Aservice%3A%3Aorg123456789%3Asearch-geocoding-1

Get usage csv by projectHrn

As shown in the following, you can retrieve the usage csv by using the projectHrn. This tutorial uses hrn:here:authorization::myrealm:project/my-project-0000 as the projectHrn.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789/csv?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&projectHrn=hrn%3Ahere%3Aauthorization%3A%3Amyrealm%3Aproject%2Fmy-project-0000

Get usage csv by appId

As shown in the following, you can retrieve the usage csv by using the appId. This tutorial uses j1dasda012edasfgne as the appId.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789/csv?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&appId=j1dasda012edasfgne

Get usage csv by billingTag

As shown in the following, you can retrieve the usage csv by using the billingTag. This tutorial uses testtag as the billingTag.

Request

    GET https://usage.bam.api.here.com/v2/usage/realms/org123456789/csv?startDate=2021-07-01T10:39:51&endDate=2021-08-30T10:39:51&billingTag=testtag

Response: HTTP 200 OK

"Date and time (usageDateTime)","Org ID (realmId)","Category (category)","App ID (appId)","Item (featureId)","Subscription ID (billingSubscriptionId)","Resource ID (resourceHrn)","Item description (name)","Unit (valueDriver)","Project ID (projectHrn)","Billing tag (billingTag)","Usage Amount (billableValue)","Charge Number (billingChargeNumber)","Usage Amount (usageValue)"
"","org123456789","Location Services","","hrn:here:service::org123456789:feature1","","","Autocomplete","Transactions","","","144940.0000","","144940.0000"
"","org123456789","Location Services","","hrn:here:service::org123456789:feature2","","","Geocode & Reverse Geocode","Transactions","","","91932.0000","","91932.0000"

For additional details, see Get usage csv by realm.

Define time range

    startDate (yyyy-MM-dd'T'HH:mm:ss)
    endDate (yyyy-MM-dd'T'HH:mm:ss)
    startDate (yyyy-MM-dd'T'HH:mm:ss), for example, 2021-07-01T10:39:51
    endDate (yyyy-MM-dd'T'HH:mm:ss), for example, 2021-08-30T10:39:51

Define detail level

You can define the granularity of records from your query at summarized, hour, day, or month. By default, detailLevel is summarized, meaning granularity is at the search criteria level.

Available values: summarized, hour, day, month.

results matching ""

    No results matching ""