Querying the List of Services
Function
You can use the API to query model services.
URI
GET /v1/{project_id}/services
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| service_id | No | String | Service ID |
| service_name | No | String | Service name |
| 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 set, only the default workspace is queried. |
| infer_type | No | String | Inference mode. The value can be real-time, batch, or edge. By default, this parameter is left blank. |
| status | No | String | Service status. By default, the service status is not filtered. You can query information by service status. The possible values are running, deploying, concerning, failed, stopped, and finished. |
| offset | No | Integer | Start page of the paging list. Default value: 0 |
| limit | No | Integer | Maximum number of records returned on each page. Default value: 1000 |
| sort_by | No | String | Sorting mode. The value can be publish_at or service_name. Default value: publish_at |
| order | No | String | Sorting order. The value can be asc or desc, indicating ascending or descending order. Default value: desc |
Request Body
None
Response Body
| Parameter | Type | Description |
|---|---|---|
| total_count | Integer | Total number of services that meet the search criteria when no paging is implemented |
| count | Integer | Number of services in the query result. If offset and limit are not set, the values of count and total are the same. |
| services | service array | Collection of the queried services. For details, see Table 4. |
| Parameter | Type | Description |
|---|---|---|
| service_id | String | Service ID |
| service_name | String | Service name |
| description | String | Service description |
| tenant | String | Tenant to which a service belongs |
| project | String | Project to which a service belongs |
| owner | String | User to which a service belongs |
| publish_at | Long | Latest service release time, in milliseconds calculated from 1970.1.1 0:0:0 UTC |
| infer_type | String | Inference mode. The value can be real-time, batch, or edge. |
| workspace_id | String | Workspace ID |
| status | String | Service status. The value can be running, deploying, concerning, failed, stopped, or finished.
|
| 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. |
| finished_time | Number | Batch service end time, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is returned only when the service is a batch service. |
| progress | integer | Deployment progress. This parameter is returned when the status is deploying. |
| invocation_times | Long | Total number of service calls |
| failed_times | Long | Number of failed service calls |
| is_shared | Boolean | Whether a service is subscribed |
| shared_count | Number | Number of subscribed services |
| schedule | schedule array | Service scheduling. For details, see Table 5. |
| due_time | number | Time when a real-time service automatically stops, in milliseconds calculated from 1970.1.1 0:0:0 UTC. |
| operation_time | number | Operation time of a request |
| is_opened_sample_collection | String | Whether to enable data collection. The default value is false. |
| transition_at | number | Time when the service status changes |
| is_free | Boolean | Whether a service uses the free-of-charge flavor |
| additional_properties | Map<String, Object> | Additional service attribute. If this parameter is not set, no value is returned. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Scheduling type. Currently, only the value stop is supported. |
| time_unit | Yes | String | Scheduling time unit. Possible values are as follows:
|
| duration | Yes | Integer | Value that maps to the time unit. For example, if the task stops after two hours, set time_unit to HOURS and duration to 2. |
Samples
The following shows how to query model services.
- Sample request
GET https://endpoint/v1/{project_id}/services
- Sample response
{ "count": 2, "total_count": 2, "services": [ { "service_id": "8da30673-908d-45a7-90a4-65f98e69fc34", "service_name": "service-demo", "tenant": "xxx", "project": "xxx", "owner": "xxx", "publish_at": 1584622900171, "infer_type": "real-time", "status": "stopped", "progress": 100, "invocation_times": 0, "failed_times": 0, "is_shared": false, "shared_count": 0, "workspace_id": "0", "schedule": [ { "type": "stop", "duration": 1, "time_unit": "HOURS" } ], "due_time": 1584626633902, "operation_time": 1586250354961, "is_opened_sample_collection": false, "additional_properties": {}, "is_free": false, "transition_at": 1584623163721 }, { "service_id": "912f1a4a-5962-455c-b11c-5fdf06045cb3", "service_name": "service-demo2", "tenant": "xxx", "project": "xxx", "owner": "xxx", "publish_at": 1584618274410, "infer_type": "real-time", "status": "stopped", "progress": 100, "invocation_times": 0, "failed_times": 0, "is_shared": false, "shared_count": 0, "workspace_id": "0", "schedule": [ { "type": "stop", "duration": 1, "time_unit": "HOURS" } ], "due_time": 1584622027673, "operation_time": 1586250354961, "is_opened_sample_collection": false, "additional_properties": {}, "is_free": false, "transition_at": 1584618498528 } ] }
Status Code
For details about the status code, see Table 1.
Last Article: Deploying a Model as a Service
Next Article: Querying the Details About a Service
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.