Updated on 2023-04-25 GMT+08:00

Querying All Facial Image Libraries

Function

This API is used to query the statuses of all facial image libraries of the current user.

Prerequisites:

Ensure that you have enabled FRS. For detailed operations, see Applying for FRS.

URI

GET /v2/{project_id}/face-sets

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the ID, see Obtaining the Project ID/Account Name/AK/SK.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

During API authentication using a token, the token is added to requests to obtain permissions for calling the API. The value of X-Subject-Token in the response header is the obtained token.

Content-Type

Yes

String

MIME type of the request body. The value is application/json.

Response Parameters

Status code: 200

Table 3 Response body parameter

Parameter

Type

Description

face_sets_info

Array of FaceSetInfo objects

Facial image library information. For details, see FaceSetInfo. This parameter is not included when the API fails to be called.

Table 4 FaceSetInfo

Parameter

Type

Description

face_number

Integer

Number of existing facial features in a facial image library

external_fields

Object

Additional field a user customizes

face_set_id

String

ID of the facial image library. It is a randomly generated string containing eight characters.

face_set_name

String

Name of the facial image library

create_date

String

Creation time

face_set_capacity

Integer

Maximum capacity of a facial image library. If face_set_capacity is not specified when a face image library is created, the face image library can contain a maximum of 100,000 facial features by default.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code when calling the API failed. This parameter is not included when the API is successfully called.

error_msg

String

Error message returned after the API fails to be called. This parameter is not included when the API is successfully called.

Example Requests

For details about how to obtain the value of X-Auth-Token, see Authentication.

  • Example request
    GET https://{endpoint}/v2/{project_id}/face-sets
    Request Header:
    Content-Type: application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDT...

Example Responses

Status code: 200

Response example (successful request)
{
  "face_sets_info": [
    {
      "face_number": 0,
      "face_set_id": "ylXMMZTO",
      "face_set_name": "test",
      "create_date": "2018-05-11 07:49:40",
      "face_set_capacity": 100000,
      "external_fields": {
        "number": {
          "type": "integer"
        },
        "id": {
          "type": "string"
        },
        "timestamp": {
          "type": "long"
        }
      }
    }
  ]

}

Status code: 400

Example response (failed request)
{
  "error_code": "FRS.0002",
  "error_msg": "The authentication token is abnormal."
}

Status Code

For details about the status code, see Status Codes.

Error Code

For details about the error code, see Error Codes.