Updated on 2024-01-30 GMT+08:00

Obtaining Task Pricing Details

Function

This API is used to query the task pricing details.

Constraints

This API can be used only in certain regions. For details, see Endpoints.

URI

GET /v5/{project_id}/jobs/{job_id}/metering

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details, see Obtaining a Project ID.

job_id

Yes

String

Task ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM.

It is a response to the API for obtaining a user token. This API is the only one that does not require authentication.

After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

product_info_list

Array of objects

Resource information list.

For details, see Table 4.

Table 4 Data structure description of field product_info_list

Parameter

Type

Description

id

String

ID, which is used to identify the mapping between the inquiry result and the request and must be unique in an inquiry.

cloud_service_type

String

Specifies the service type code of the purchased product. For example, the service type code for EC2 is hws.service.type.ec2.

resource_type

String

Specifies the resource type code of the purchased product. For example, the resource type code for VMs in EC2 is hws.resource.type.vm.

resource_spec_code

String

Specifies the resource specifications code of the purchased product. For example, the value for VMs of the small specifications is m1.tiny.

resource_size

Integer

Resource capacity measurement ID.

resource_size_measure_id

Integer

Specifies the resource capacity. It can be the subscribed volume size or bandwidth size.

usage_factor

String

Specifies the usage factor. This parameter is mandatory for a pay-per-use task. The value is the same as the usage factor of SDRs. The mappings between cloud services and usage factors are as follows:

  • Duration: Cloud server
  • flow: traffic

usage_value

Double

Specifies the usage value. This parameter is mandatory for a pay-per-use task. For example, the resources are billed by hour, the usage value is 1, and the usage measurement unit is hour.

usage_measure_id

Integer

Specifies the usage measurement unit. This parameter is mandatory for a pay-per-use task. For example, the resources are billed by hour, the usage value is 1, and the usage measurement unit is hour.

  • 4: Hour
  • 10: GB
  • 11: MB
  • 13: Byte
  • 17: FLOW_GB

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 12

Maximum length: 12

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

Example Request

Obtaining the task pricing details

https://{endpoint}/v5/{project_id}/jobs/{job_id}/metering

Example Response

Status code: 200

OK
{
  "product_info_list": [
    {
      "id": "78f3a9f1-3d8d-43f0-acc4-ee93f8a9d934",
      "cloud_service_type": "hws.service.type.drs",
      "resource_type": "hws.resource.type.drs.vm",
      "resource_spec_code": "drs.lg.dr",
      "resource_size": 1,
      "usage_factor": "Duration",
      "usage_value": 1,
      "usage_measure_id": 4
    },
    {
      "id": "f52a74ce-5b11-4c5b-b365-488d9fc38882",
      "cloud_service_type": "hws.service.type.drs",
      "resource_type": "hws.resource.type.drs.flow",
      "resource_spec_code": "drs.flow.free",
      "resource_size": 1,
      "usage_factor": "flow",
      "usage_value": 1,
      "usage_measure_id": 17
    }
  ]
}

Status code: 400

Bad Request

{
  "error_code": "DRS.M00202",
  "error_msg": "The value of parameter jobId is invalid."
}

Error Code

For details, see Error Code.