Skip to content

How-to guides

The public API for the consumption log is small, consisting of three endpoints for fetching data.

Endpoints

POST/api/consumption/log/list

  • List logs filtered and aggregated according to the input from the body.
  • Remember that the input has filtering and aggregation options as described in Concepts.
  • Body content

    {
      "from": "2024-04-02T11:39:15.525Z",
      "to": "2024-08-02T11:39:15.525Z",
      "aggregateBy": {
        "Time": "all",
        "ProjectId": "<guid>",
        "ResourceId": "all",
        "OperationId": "all"
      },
      "projectId": "<guid>",
      "metricType": "ComputeTime",
      "sortOrder": "Desc",
      "offset": 0,
      "limit": 0,
      "tenantId": "<guid>"
    }
    

  • Example Output

{
  "offset": 0,
  "limit": 0,
  "data": [
    {
      "tenantId": "<guid>",
      "projectId": "<guid>",
      "unit": "minute",
      "value": 4.0,
      "metricType": "ComputeTime",
      "billingInformation": {
        "billingReference": "ABC123",
        "billingReferenceType": "EXT"
      }
    }
  ]
}

POST/api/consumption/log/my-list

  • List the calling users logs filtered and aggregated according to the input from the body.
  • Remember that the input has filtering and aggregation options as described in Concepts.
  • Body content
{
  "from": "2024-04-02T11:39:15.525Z",
  "to": "2024-08-02T11:39:15.525Z",
  "aggregateBy": {
    "Time": "day",
    "ProjectId": "all",
    "ResourceId": "all",
    "OperationId": "all",
    "BillingReference": "billingReference"
  },
  "projectId": "<guid>",
  "sortOrder": "Asc",
  "offset": 0,
  "limit": 0,
  "tenantId": "<guid>"
}
  • Example Output
{
  "offset": 0,
  "limit": 0,
  "data": [
    {
      "tenantId": "<guid>",
      "projectId": "<guid>",
      "resourceId": "<guid>",
      "validFrom": "2024-04-02T11:39:15.525Z",
      "validTo": "2024-08-02T11:39:15.525Z",
      "unit": "minute",
      "value": 4,
      "metricType": "ComputeTime",
      "billingInformation": {
        "billingReference": "ABS123",
        "billingReferenceTag": "<string>",
        "billingReferenceType": "EXT"
      }
    }
  ]
}

POST/api/consumption/log/{id}

  • Retrieve a particular consumption log based on the id.
  • Example Output
{
  "id": 0,
  "validFrom": "2024-04-02T11:39:15.525Z",
  "validTo": "2024-08-02T11:39:15.525Z",
  "createdAt": "2024-08-02T11:45:41.428Z",
  "projectId": "<guid>",
  "operationId": "<guid>",
  "clientId": "<string>",
  "clientName": "<string>",
  "clientVersion": "<string>",
  "tags": {
    "additionalProp1": "<string>",
    "additionalProp2": "<string>",
    "additionalProp3": "<string>"
  },
  "tenantId": "<guid>",
  "resourceId": "<guid>",
  "metricType": "<string>",
  "unit": "<string>",
  "value": 0,
  "billingInformation": {
    "billingReference": "<string>",
    "billingReferenceTag": "<string>",
    "billingReferenceType": "<string>"
  }
}