Help Center> ModelArts> API Reference> Model Management> Models> Querying the List of Models

Querying the List of Models

Function

This API is used to query the models that meet the search criteria.

URI

GET /v1/{project_id}/models
Table 1 describes the required parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

model_name

No

String

Model name. Fuzzy match is supported.

model_version

No

String

Model version

model_status

No

String

Model status. You can query models based on the model status. Possible values are as follows:

  • publishing
  • published
  • failed
  • building
  • building_failed

model_type

No

String

Model type. A list of models of this type are queried. model_type and not_model_type are mutually exclusive and cannot co-exist.

not_model_type

No

String

Model type. A list of models of types except for this type are queried.

description

No

String

Description. Fuzzy match is supported.

offset

No

Integer

Index of the page to be queried. 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 create_at, model_version, or model_size. Default value: create_at

order

No

String

Sorting order. The value can be asc or desc, indicating ascending or descending order. Default value: desc

workspace_id

No

String

Workspace ID. Default value: 0

Request Body

None

Response Body

Table 3 describes the response parameters.
Table 3 Parameter description

Parameter

Type

Description

total_count

Integer

Total number of models that meet the search criteria when no paging is implemented

count

Integer

Number of models

models

model array

Model metadata. For details, see Table 4.

Table 4 model parameters

Parameter

Type

Description

model_id

String

Model ID

model_name

String

Model name

model_version

String

Model version

model_status

String

Model status

model_type

String

Model type. The value can be TensorFlow, MXNet, Spark_MLlib, Scikit_Learn, XGBoost, MindSpore, Image, or PyTorch.

model_size

Long

Model size, in bytes

tenant

String

Tenant to which a model belongs

project

String

Project to which a model belongs

owner

String

User to which a model belongs

create_at

Long

Time when a model is created, in milliseconds calculated from 1970.1.1 0:0:0 UTC

description

String

Model description

source_type

String

Model source type. This parameter is valid only when the model is deployed by an ExeML project. The value is auto. If the model is deployed by a training job, leave this parameter blank. By default, this parameter is left blank.

workspace_id

String

Workspace ID

model_source

String

Model source. Possible values are as follows:

  • auto: ExeML
  • algos: built-in algorithm
  • custom: custom model

tunable

boolean

Whether a model can be tuned. Possible values are as follows:

  • true: yes
  • false: no

market_flag

boolean

Whether a model is subscribed from the marketplace. Possible values are as follows:

  • true: yes
  • false: no

publishable_flag

boolean

Whether a model can be published to the marketplace. Possible values are as follows:

  • true: yes
  • false: no

install_type

String array

Model deployment type, that is, which service a model can be deployed as. Possible values are real-time (real-time service), batch (batch service), and edge (edge service).

subscription_id

String

Model subscription ID

extra

String

Extended field

specification

Specification structure

Minimum deployment specifications

Samples

The following shows how to query models.

  • Sample request
    GET    https://endpoint/v1/{project_id}/models
  • Sample response
        {
          "total_count": 1,
          "count": 1,
          "models": [
            {
              "model_name": "mnist",
              "model_version": "1.0.0",
              "model_id": "10eb0091-887f-4839-9929-cbc884f1e20e",
              "model_type": "tensorflow",
              "model_size": 5012312,
              "tenant": "6d28e85aa78b4e1a9b4bd83501bcd4a1",
              "project": "d04c10db1f264cfeb1966deff1a3527c",
              "owner": "6d28e85aa78b4e1a9b4bd83501bcd4a1",
              "create_at": 1533041553000,
              "description": "mnist model",
              "workspace_id": "0",
              "specification":{}
            }
          ]
        }

Status Code

For details about the status code, see Table 1.