Search Metrics

Search Metrics

You can start a search to get a sortable, filterable and paginated list of metrics in an organization

Request
URI
POST
https://console.cloud.vmware.com/commerce/cost-and-usage/api/{org_id}/metrics/search
COPY
Path Parameters
string
org_id
Required

Unique identifier (GUID) of the organization

Query Parameters
string
locale
Optional

Locale with language preference (e.g. en_US)

string of array
sort
Optional

Sorting criteria for the paginated request in the format: "property(,asc|desc)". For multiple sort criteria: "sort=property1(,asc|desc)&sort=property2(,asc|desc)". Supported sorting properties are "metric_id, service_definition_id, seller_id, usage_date_time, commit_quantity, usage_quantity, overage_quantity, status". Default is "metric_id,asc"

string of array
filter
Optional

Filtering criteria for the paginated request in the format: "property,eq:value". For multiple filter criteria: "filter=property1,eq:value&filter=property2,eq:value". Supported filtering properties are "metric_id, service_definition_id, seller_id, usage_date_time, commit_quantity, usage_quantity, overage_quantity, status. A property may be specified multiple times to match against multiple values"

integer
size
Optional

Size of each page. Default = 20

integer
page
Optional

The index of requested page (0-based). Default = 0

string
resource_id
Optional

Unique identifier of the resource


Request Body

JSON object containing filter criteria as charge attributes

MetricsSearchBody of type(s) application/json
Optional
{
    "charge_attributes": {
        "aws_region": "EU_WEST_3",
        "category": "HOST_USAGE"
    }
}
charge_attributes
Optional

charge_attributes

Responses
200

OK

Returns MetricsSearchResponse of type(s) application/json
{
    "content": [
        {
            "metadata": {
                "metric_id": "<metric ID for vRNI vCPUs Public Cloud>",
                "service_definition_id": "<service definition ID for VMC-AWS>",
                "display_name": "i3en US West 2",
                "unit_of_measure_display_name": "Hosts",
                "charge_attributes": {
                    "category": "HOST_USAGE"
                }
            },
            "usage": {
                "commitment": 3,
                "usage": 3,
                "overage": 0,
                "status": "AT_COMMITMENT",
                "seller": "VMWARE",
                "last_updated": "2021-06-20T01:02:03.000Z",
                "resources": [
                    {
                        "resource_id": "res1",
                        "usage_quantity": 10
                    }
                ]
            }
        }
    ],
    "empty": false,
    "first": false,
    "last": false,
    "number": 0,
    "number_of_elements": 0,
    "pageable": {
        "offset": 0,
        "page_number": 0,
        "page_size": 0,
        "paged": false,
        "sort": {
            "empty": false,
            "sorted": false,
            "unsorted": false
        },
        "unpaged": false
    },
    "size": 0,
    "sort": {
        "empty": false,
        "sorted": false,
        "unsorted": false
    },
    "total_elements": 0,
    "total_pages": 0
}
content
Optional

content

boolean
empty
Optional

True if no elements in the system match given request

boolean
first
Optional

True if this is the first page of items

boolean
last
Optional

True if this is the last page of MetricUsage items

number
Optional

number

integer As int32 As int32
number_of_elements
Optional

The number of MetricUsage items in the response for given request after pagination operations. If number of items is less then size, it will be equal to total_elements.

pageable
Optional

pageable

integer As int32 As int32
size
Optional

Max number of MetricUsage items in the response (controlled by query parameter size or system default)

sort
Optional

sort

integer As int64 As int64
total_elements
Optional

The total number of MetricUsage items in the system for given request.

total_pages
Optional

total_pages


400

Bad Request

Returns ApiError of type(s) application/json
{
    "error_code": "string",
    "error_message": "string",
    "error_details": [
        {
            "error_code": "string",
            "error_message": "string"
        }
    ]
}
string
error_code
Required

The code associated with the error

string
error_message
Required

A description of the error that occurred

error_details
Optional

Additional error details for ValidationException errors


401

Unauthorized

Operation doesn't return any data structure

403

Forbidden

Operation doesn't return any data structure