Consumption History
This document provides detailed information about the Consumption History endpoint, which allows users to query the web services consumption history by service and API key to identify the associated company.
Table of Contents
- Overview
- Endpoint Details
- Parameters
- Example Request
- Response Format
- HTTP Status Codes
- Common Errors
- Additional Notes
Overview
The Consumption History endpoint is designed to retrieve the consumption history of web services. This is particularly useful for monitoring service usage by companies identified through their API keys.
Endpoint Details
URL Base: ~/v1/ConsumptionHistory
HTTP Method: GET
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceName |
string | No | Name of the service. |
httpStatus |
string | No | HTTP status code. Example: 200. |
beginDate |
string | No | Start date of the consumption period (ISO 8601 format). |
endDate |
string | No | End date of the consumption period (ISO 8601 format). See Notes |
limit |
string | No | Number of results to retrieve. Default is 20. See Notes |
offset |
string | No | Offset for paginated results. |
Example Request
GET ~/v1/ConsumptionHistory?serviceName=exampleService&beginDate=2025-01-01&endDate=2025-01-31&limit=100&offset=0
Host: api.example.com
Authorization: Bearer <your_token>
Content-Type: application/json
Response Format
Example Response
{
"_id": "string",
"serviceName": "string",
"userAgent": "string",
"ip": "string",
"companyId": "string",
"uri": "string",
"queryParams": "string",
"responseHttpStatus": "string",
"proccessingTime": 0,
"customerCode": "string",
"warning": "string",
"createdAt": "string",
"updatedAt": "string",
"XOperationReference": "string"
}
Field Descriptions
| Field | Type | Description |
|---|---|---|
_id |
string | Unique identifier for the record. |
serviceName |
string | Name of the service queried. |
userAgent |
string | User agent of the request. |
ip |
string | IP address from which the request was made. |
companyId |
string | Identifier of the associated company. |
uri |
string | URI of the requested resource. |
queryParams |
string | Query parameters sent in the request. |
responseHttpStatus |
string | HTTP status code of the response. |
proccessingTime |
integer | Time taken to process the request (in milliseconds). |
customerCode |
string | Code of the customer associated with the request. |
warning |
string | Warnings related to the request, if any. |
createdAt |
string | Timestamp of when the record was created (ISO 8601 format). |
updatedAt |
string | Timestamp of the last update to the record (ISO 8601 format). |
XOperationReference |
string | Unique reference for the operation performed. See X-OperationReference Section |
HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Request was successful. |
| 400 | Bad request (invalid parameters). |
| 401 | Unauthorized (missing or invalid token). |
| 404 | Resource not found. |
| 500 | Internal server error. |
Common Errors
- 400 Bad Request: Occurs when the parameters are invalid or improperly formatted.
- 401 Unauthorized: Ensure a valid token is included in the
Authorizationheader. - 500 Internal Server Error: Contact support if this error persists.
Additional Notes
- The
beginDateandendDateparameters must follow the ISO 8601 format (YYYY-MM-DD). - The maximum value for the
limitparameter is100. - Use the
limitandoffsetparameters for efficient pagination of results.