Skip to content
Last updated

HPE GreenLake Consumption Analytics API

This page provides an introduction and quick start guide for the HPE GreenLake Consumption Analytics API:

  • Overview—See a high-level description of the API.
  • Developer guide—Review a quick start guide that helps you get started with the API.

Overview

The HPE GreenLake Consumption Analytics API provides public, read-only access to reporting data for cloud consumption. It enables authenticated external clients to retrieve available report definitions, view their structure, and download report results as CSV files.

Features

  • Retrieve a list of available reports accessible to the authenticated client
  • Fetch the full definition of a specific report, including filters, metrics, and charts
  • Download the output of a report as a CSV file for external analysis

Use cases

  • Automated report extraction—Fetch and download report contents periodically to power custom dashboards or integrate with data warehouses.
  • Report inspection—Use the API to programmatically inspect report structure, including filters and fields, before execution.
  • Data pipeline integration—Incorporate downloaded CSV outputs into automated workflows for billing, analytics, or compliance reporting.

Developer guide

This guide provides foundational details and examples to help you use the Consumption Analytics API on the HPE GreenLake cloud.

Prerequisites


Hostname

When forming a Consumption Analytics REST API call, choose the hostname that is closest to your region:

Endpoints

The URIs for the HPE GreenLake Consumption Analytics API are as follows:

  • GET /consumption-analytics/v1/reports—Retrieves a list of available reports that the caller has permission to access.
  • GET /consumption-analytics/v1/reports/{id}—Retrieves the full definition of a specific report, including filters, columns, charts, sharing settings, and metadata.
  • GET /consumption-analytics/v1/reports/{id}/contents—Downloads the contents of a specific report in CSV format.

Permissions

Any user with access to the Consumption Analytics application in HPE GreenLake can access both the UI and the API, subject to configured permissions.

Generating a token

You must configure API credentials and generate an OAuth-based access token to make API calls.

  1. Create a personal API client.
    • Select the HPE GreenLake Cloud Platform service.
  2. Generate an access token.
  3. Use the access token as an authorization bearer token to make secure REST API calls.

Use the following cURL command to get the token:

curl -X POST https://sso.common.cloud.hpe.com/as/token.oauth2 -H
"Content-Type: application/x-www-form-urlencoded"
-d "grant_type=client_credentials&client_id=$YOUR_CLIENT_ID&client_secret=$YOUR_CLIENT_SECRET"

The obtained token is valid for two hours.

Making it all work


Listing available reports

This endpoint allows you to retrieve a list of all available reports. Only reports that the caller has permission to access will be included in the response.

Example request:

GET '{{HOSTNAME}}/consumption-analytics/v1/reports'

Example response:

[
  {
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "name": "Cost Analysis (Last 30 Days)",
    "created": {
      "id": "system",
      "name": "System",
      "time": "2022-05-04T22:27:12.071872"
    },
    "lastUpdated": {
      "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
      "name": "User A",
      "time": "2023-02-15T18:41:24.531274"
    },
    "shared": true,
    "owner": false
  },
  {
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0002",
    "name": "Monthly Usage Cost Report",
    "created": {
      "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "name": "User B",
      "time": "2023-08-31T16:56:41.044146",
      "email": "user.b@example.com"
    },
    "lastUpdated": {
      "id": "system",
      "name": "System",
      "time": "2023-08-31T16:56:41.044146"
    },
    "shared": true,
    "owner": false
  },
  {
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0003",
    "name": "Cloud Cost Breakdown Report",
    "created": {
      "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
      "name": "User C",
      "time": "2023-08-31T17:07:37.97998",
      "email": "user.c@example.com"
    },
    "lastUpdated": {
      "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
      "name": "User C",
      "time": "2024-09-05T03:17:11.578997"
    },
    "shared": true,
    "owner": false
  }
]

Downloading a report as CSV

This endpoint allows you to download the contents of a specific report as a CSV file.

Example request:

GET '{{HOSTNAME}}/consumption-analytics/v1/reports/{id}/contents'

Replace {id} with the ID of the report you want to download.

Example response:

ext_318a9be98af05aa69cff166c29de7ccf_s,sys_Product_s,sys_Cost_f,sys_AccountingDate_d
"",VM,1701.59,2025-02-24
"",VM,1733.42,2025-02-20
"",VM,1729.88,2025-02-25
"",VM,1732.28,2025-02-27
"",VM,1730.24,2025-02-26
"",VM,1720.95,2025-02-18
"",VM,1731.17,2025-02-21
"",VM,1718.34,2025-02-19
"",VM,1537.63,2025-03-03
"",VM,1563.79,2025-03-04
"",VM,1563.79,2025-03-05
"",VM,1563.79,2025-03-06
"",VM,1562.71,2025-03-07
"",VM,1732.3,2025-02-28
"",VM,1570.89,2025-03-12
"",VM,1570.53,2025-03-13
"",VM,1563.01,2025-03-11
"",VM,1567.19,2025-03-19
"",VM,1527.94,2025-03-10
  • The response will return a CSV file with Content-Disposition set to attachment.

Retrieving a report definition

This endpoint allows you to fetch the full definition of a specific report, including its filters, columns, charts, sharing information, and metadata.

Example request:

GET '{{HOSTNAME}}/consumption-analytics/v1/reports/{id}'

Replace {id} with the ID of the report you want to retrieve.

Example response:

{
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name": "Sample Report Name",
    "description": "Example report description",
    "filter": {
        "dateFilter": {
            "type": "RELATIVE",
            "relativeRange": "LAST_90_DAYS"
        },
        "fieldFilters": [
            {
                "name": "sys_ServiceCategory_s",
                "operator": "NOT_EMPTY",
                "values": []
            }
        ]
    },
    "columns": [
        {
            "fieldName": "sys_ServiceCategory_s",
            "aggFunction": "NONE",
            "group": false,
            "formatting": {}
        },
        {
            "fieldName": "sys_Cost_f",
            "aggFunction": "SUM",
            "group": false,
            "formatting": {
                "placesAfterDecimal": 2
            }
        }
    ],
    "created": {
        "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "name": "API Client User",
        "time": "2025-03-21T00:00:00.000000",
        "email": "user@example.com"
    },
    "lastUpdated": {
        "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "name": "API Client User",
        "time": "2025-03-21T00:00:00.000000"
    },
    "owner": true,
    "charts": [
        {
            "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
            "type": "BAR",
            "title": "Sample Chart Title",
            "definition": {
                "metric": "sys_Cost_f",
                "metricAggFunction": "SUM",
                "series": "sys_ServiceCategory_s",
                "excludeOther": false,
                "maxGroups": 10,
                "orientation": "VERTICAL"
            }
        }
    ],
    "sharing": {
        "type": "PRIVATE"
    },
    "pivot": false,
    "shared": false
}

This API is useful for inspecting or reconstructing a report, especially prior to downloading or modifying it.