Querying Orders

Function

This API is used to obtain orders.

URI

GET /v1/{project_id}/orders

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

workspaceId

No

String

Workspace ID. The default value is 0.

involvedName

No

String

Name of an associated resource, for example, the display name of the resource pool.

limit

No

Integer

Maximum number of records that can be queried at a time. If this parameter is left empty or set to 0, 100 records are returned by default. A maximum of 500 records can be queried.

offset

No

Integer

Start position of the query. The value ranges from 0 to 500.

since

No

Long

Event start timestamp, in milliseconds. Only orders within the last month can be queried.

until

No

Long

Event end timestamp, in milliseconds.

phase

No

String

Event processing status. The options are as follows:

  • pending: The order is pending, which is typically caused by an unpaid or unapproved request.

  • running: The order is being processed.

  • successed: The order is successful.

  • failed: The order failed.

resource

No

String

Type of the requested resource. The default value is pools. The options are as follows:

  • pools: resource pool

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total number of results that meet the query conditions.

items

Array of Order objects

Returned event details.

Table 5 Order

Parameter

Type

Description

creationTimestamp

Long

Time when an order is created, in milliseconds.

endTimestamp

Long

Time when an order ends, in milliseconds. If the order has not ended, 0 is returned.

beginTimestamp

Long

Time when an order starts to be processed, in milliseconds. If the processing has not started, 0 is returned.

orderName

String

Order name.

orderId

String

Order ID.

resourceName

String

Name of the resource associated with an order.

resourceDisplayName

String

Displayed name of the resource associated with an order.

workspaceId

String

Workspace ID associated with an order.

initCount

Array of PoolResourceFlavorCount objects

Initial status of the resource pool associated with an order. For a new resource pool, this parameter is left empty.

specCount

Array of PoolResourceFlavorCount objects

Target status of the resource pool associated with an order.

resultCount

Array of PoolResourceFlavorCount objects

Final resource status of the resource pool associated with an order.

operation

String

Order operation. The options are as follows:

  • apply: Create an order.

  • modify: Modify an order.

  • delete: Delete an order.

phase

String

Order result. The options are as follows:

  • pending: The order is pending.

  • processing: The order is being processed.

  • successed: The order is successful.

  • failed: The order failed.

failReason

String

If the phase is in the failure state, the failure cause is returned.

Table 6 PoolResourceFlavorCount

Parameter

Type

Description

flavor

String

Resource flavor name, for example, modelarts.vm.gpu.t4u8.

count

Integer

Minimum count for the flavors in a pool.

maxCount

Integer

Elastic usage of the resource flavor. This parameter value is the same the count value in a physical pool.

azs

Array of azs objects

Number of AZs where resources are located.

Table 7 azs

Parameter

Type

Description

az

String

AZ name.

count

Integer

Number of AZ resources.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Obtain successful orders of resource pool pool-5ed5 by page, with 20 results returned.

/v1/{project_id}/orders?involvedName=pool-5ed5&limit=20&offset=0&result=successed

Example Responses

Status code: 200

OK.

{
  "count" : 1,
  "items" : [ {
    "creationTimestamp" : 1682043883000,
    "endTimestamp" : 1682043893000,
    "beginTimestamp" : 1682043893000,
    "orderName" : "order.pool-5ed5-w4l2n",
    "orderId" : "CS2304191748WNW2R",
    "resourceName" : "pool-5ed5-04f258c84780d5a52f3bc00dc15aa5e7",
    "resourceDisplayName" : "pool-5ed5",
    "specCount" : [ {
      "flavor" : "modelarts.vm.cpu.2u.d",
      "count" : 1
    } ],
    "billingMode" : "1",
    "periodType" : "2",
    "periodNum" : "1",
    "operation" : "apply",
    "result" : "successed",
    "phase" : "completed"
  } ]
}

Status code: 400

Bad request.

{
  "error_code" : "ModelArts.50004000",
  "error_msg" : "Bad request."
}

Status code: 404

Not found.

{
  "error_code" : "ModelArts.50015001",
  "error_msg" : "Pool {name} not found."
}

Status Codes

Status Code

Description

200

OK.

400

Bad request.

404

Not found.

Error Codes

See Error Codes.