나열 시 필터링

리소스, 평가 또는 작업을 나열할 때 필터링을 사용하여 더 구체적인 결과를 반환할 수 있습니다.

Operations

다음 매개변수를 사용하여 나열된 작업을 필터링할 수 있습니다.

필터

  • operation_id - 제공된 값과 동일한 ID가 있는 모든 작업을 반환합니다. 특정 값과 같지 않은(!=) 작업을 지정할 수도 있습니다.
  • done - "done": true 상태인 모든 작업을 반환합니다. 진행 중인 작업("done"이 아닌 작업)을 지정할 수도 있습니다.

    쿼리:

    • ?filter="done=true"
    • ?filter="done!=true"
  • worksOn - 리소스(데이터세트 또는 모델)에서 작동하는 모든 작업을 반환합니다. 특정 값과 같지 않은(!=) 작업을 지정할 수도 있습니다.

    쿼리:

    • dataset - ?filter="worksOn=projects/project-id/locations/us-central1/datasets/dataset-id"
    • model - ?filter="worksOn=projects/project-id/locations/us-central1/models/model-id"

Additional query parameters

  • pageSize - Limits the results returned to a set number of lines. If not specified, the server will choose a default size.
  • pageToken - A token to retrieve next page of results. An initial query with a set pageSize and results greater than will fit on that page size also returns a nextPageToken. This token can then be passed to pageToken to get subsequent results.

다음 명령줄 코드 샘플은 완료된 작업(상태: "done": true)별로 나열된 작업을 필터링하는 방법을 보여줍니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • project-id: Google Cloud Platform 프로젝트 ID

HTTP 메서드 및 URL:

GET https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/operations?filter="done=true"

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

다음 명령어를 실행합니다.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/operations?filter="done=true""

PowerShell

다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/operations?filter="done=true"" | Select-Object -Expand Content

요청이 성공하면 서버가 200 OK HTTP 상태 코드와 응답을 JSON 형식으로 반환합니다.

다음 응답은 여러 AutoML 작업이 포함된 프로젝트의 응답으로, 완료된 작업(?filter="done=true")으로 필터링되었습니다.

추가 쿼리 매개변수

다른 매개변수(pageSize, pageToken)로 쿼리하려면 매개변수를 URL에 추가합니다.

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/model/model-id/modelEvaluations?pageSize=INT

매개변수를 앰퍼샌드(&)로 연결할 수도 있습니다.

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/model/model-id/modelEvaluations?filter="done=true&pageSize=INT&pageToken=next-page-token"

Datasets

You can filter listed datasets using the following parameters:

Filters

  • dataset_metadata - returns all datasets with the target metadata type.

Additional query parameters

  • pageSize - Limits the results returned to a set number of lines. If not specified, the server will choose a default size.
  • pageToken - A token to retrieve next page of results. An initial query with a set pageSize and results greater than will fit on that page size also returns a nextPageToken. This token can then be passed to pageToken to get subsequent results.

The following command line code sample shows how to filter listed datasets by specifying the dataset_metadata.

Before using any of the request data, make the following replacements:

  • project-id: your Google Cloud Platform project ID.
  • dataset-metadata-value: the type of dataset_metadata you are filtering. These values depend on the AutoML problem type.

HTTP method and URL:

GET https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/datasets?filter="dataset-metadata-value"

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/datasets?filter="dataset-metadata-value""

PowerShell

Execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/datasets?filter="dataset-metadata-value"" | Select-Object -Expand Content

If the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format.

The following response is from a project with multiple AutoML dataset types, filtered for AutoML Translation datasets (?filter="translationDatasetMetadata:*").

Response:

Additional query parameters

To query with other parameters (pageSize, pageToken) append the parameter to the URL:

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/datasets?pageSize=INT

You can also concatenate parameters with an ampersand (&):

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/datasets?filter="dataset-metadata-value&pageSize=INT&pageToken=next-page-token"

Models

You can filter listed models using the following parameters:

Filters

  • model_metadata - returns all models with the target metadata type.
  • datasetId - returns all models created from a specific dataset.

Additional query parameters

  • pageSize - Limits the results returned to a set number of lines. If not specified, the server will choose a default size.
  • pageToken - A token to retrieve next page of results. An initial query with a set pageSize and results greater than will fit on that page size also returns a nextPageToken. This token can then be passed to pageToken to get subsequent results.

The following command line code sample shows how to filter listed models by specifying the model_metadata.

Before using any of the request data, make the following replacements:

  • project-id: your Google Cloud Platform project ID.
  • model-metadata-value: the type of model_metadata you are filtering. These values depend on the AutoML problem type.

HTTP method and URL:

GET https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models?filter="model-metadata-value"

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models?filter="model-metadata-value""

PowerShell

Execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models?filter="model-metadata-value"" | Select-Object -Expand Content

If the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format.

The following response is from a project with multiple AutoML model types, filtered for AutoML Natural Language models (?filter="textClassificationModelMetadata:*").

Additional query parameters

To query with other parameters (pageSize, pageToken) append the parameter to the URL:

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models?pageSize=INT

You can also concatenate parameters with an ampersand (&):

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models?filter="model-metadata-value&pageSize=INT&pageToken=next-page-token"

modelEvaulations

You can filter listed model evaluations using the following parameters:

Filters

  • annotationSpecId - returns all model evaluations with an ID equal to the provided value. You can also specify model evaulations not equal (!=) to a certain value.

Additional query parameters

  • pageSize - Limits the results returned to a set number of lines. If not specified, the server will choose a default size.
  • pageToken - A token to retrieve next page of results. An initial query with a set pageSize and results greater than will fit on that page size also returns a nextPageToken. This token can then be passed to pageToken to get subsequent results.

The following command line code sample shows how to filter listed model evaluations by specifying the annotationSpecId.

Before using any of the request data, make the following replacements:

  • project-id: your Google Cloud Platform project ID.
  • model-id: the ID of the model you want evaluations for.
  • annotation-spec-id: The ID of the annotation spec that the model evaluation applies to. The The ID is empty for the overall model evaluation.

HTTP method and URL:

GET https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models/model-id/modelEvaluations?filter="annotationSpecId=annotation-spec-id"

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models/model-id/modelEvaluations?filter="annotationSpecId=annotation-spec-id""

PowerShell

Execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models/model-id/modelEvaluations?filter="annotationSpecId=annotation-spec-id"" | Select-Object -Expand Content

If the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format.

The following response is from a project with multiple AutoML model types, filtered for model evaluations from a single model (?filter="annotationSpecId=1231173747155664896").

Additional query parameters

To query with other parameters (pageSize, pageToken) append the parameter to the URL:

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/model/model-id/modelEvaluations?pageSize=INT

You can also concatenate parameters with an ampersand (&):

https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/model/model-id/modelEvaluations?filter="annotationSpecId=annotation-spec-id&pageSize=INT&pageToken=next-page-token"