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

Obtaining Services

Function

This API is used to obtain model services.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v1/{project_id}/services

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

service_id

No

String

Service ID. By default, the service ID is not filtered.

service_name

No

String

Service name. By default, the service name is not filtered.

model_id

No

String

Model ID. By default, the model ID is not filtered.

workspace_id

No

String

Workspace ID. If this parameter is not configured, only the default workspace is obtained.

infer_type

No

String

Inference mode. By default, the inference mode is not filtered. Options:

  • real-time

  • batch

  • edge

status

No

String

Service status. By default, the service status is not filtered. Options:

  • running: The service is running properly.

  • deploying: The service is being deployed, including image creation and resource scheduling deployment.

  • concerning: An alarm has been generated, indicating that some backend instances malfunction.

  • failed: Deploying the service failed. For details about the failure cause, see the event and log tab pages.

  • stopped: The service has been stopped.

  • finished: Service running is completed. This status is available only for batch services.

  • stopping: The VM is being stopped.

  • deleting: The VM is being deleted.

  • pending: to be started. This state is available only when the system is online.

  • waiting: The resource is queuing. This state is available only for online services.

offset

No

Integer

Start page for pagination display. The default value is 0.

limit

No

Integer

Maximum number of records returned on each page. Default value: 1000

sort_by

No

String

Sorting field. Enums:

  • publish_at: service publishing time, which is the default value

  • service_name: service name

  • transition_at: update time

order

No

String

Sorting order. Enums:

  • asc: ascending order

  • desc: descending order (default value)

tags

No

String

Tag. By default, tags are not filtered.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of services that meet the search criteria when no paging is performed

count

Integer

Number of services in the query result. If offset and limit are not configured, the values of count and total are the same.

services

Array of ListServices objects

Collection of obtained services

Table 5 ListServices

Parameter

Type

Description

failed_times

Long

Number of failed service calls

owner

String

User to which a service belongs

due_time

Number

Time when an online service automatically stops, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is not returned if automatic stop is not configured.

finished_time

Number

Batch service completion time, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is returned only when the service is a batch service.

infer_type

String

Inference mode. Options:

  • real-time

  • batch

  • edge

service_name

String

Service name

description

String

Service description

project

String

Project to which a service belongs

invocation_times

Long

Total number of service calls

publish_at

Long

Latest service release time, in milliseconds calculated from 1970.1.1 0:0:0 UTC.

workspace_id

String

Workspace ID

schedule

Array of Schedule objects

Service scheduling configuration. If this parameter is not configured, no value will be returned.

start_time

Number

Batch service start time, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is returned only when the service is a batch service.

operation_time

Number

Operation time of a request

is_shared

Boolean

Whether a service is subscribed True indicates that the service is a subscription service.

service_id

String

Service ID

progress

Integer

Deployment progress. This parameter is available when the status is deploying.

shared_count

Number

Number of subscribed services

tenant

String

Tenant to which a service belongs

status

String

Service status. Options:

  • running: The service is running properly.

  • deploying: The service is being deployed, including image creation and resource scheduling deployment.

  • concerning: An alarm has been generated, indicating that some backend instances malfunction.

  • failed: Deploying the service failed. For details about the failure cause, see the event and log tab pages.

  • stopped: The service has been stopped.

  • finished: Service running is completed. This status is available only for batch services.

is_opened_sample_collection

String

Whether to enable data collection, which defaults to false

transition_at

Number

Time when the service status changes

is_free

Boolean

Whether a free-of-charge flavor is used

additional_properties

Map<String,String>

Additional service attribute. If this parameter is not configured, no value will be returned.

Table 6 Schedule

Parameter

Type

Description

duration

Integer

Value mapping a time unit. For example, if the task stops after two hours, set time_unit to HOURS and duration to 2.

time_unit

String

Scheduling time unit. Possible values are DAYS, HOURS, and MINUTES.

type

String

Scheduling type. Only the value stop is supported.

Example Requests

GET https://{endpoint}/v1/{project_id}/services

Example Responses

Status code: 200

Service list

{
  "total_count" : 1,
  "count" : 1,
  "services" : [ {
    "failed_times" : 1,
    "owner" : "b575785bcece44beb23597770fb819f9",
    "infer_type" : "real-time",
    "service_name" : "mnist",
    "description" : "",
    "project" : "b575785bcece44beb23597770fb819f9",
    "invocation_times" : 50,
    "publish_at" : 1243143243,
    "workspace_id" : 0,
    "is_shared" : false,
    "service_id" : "195c1f2d-136d-40af-a0f3-db5717d2634a",
    "shared_count" : 0,
    "tenant" : "b575785bcece44beb23597770fb819f9",
    "status" : "running"
  } ]
}

Status Codes

Status Code

Description

200

Service list

Error Codes

See Error Codes.