Add a face

Updated at:

Adds one or more face images to an individual in a face group.

Limits

  • Each individual can hold up to 20 face images.

  • A face library supports up to 100,000 face images. Contact your account manager if you need a larger face library.

If no custom face search is performed within one year after adding a face image, the face image and its face group are deleted automatically.

Request syntax

POST /green/sface/face/add HTTPS|HTTP

Request headers

This operation uses only common request headers. For more information, see Common request headers.

Request parameters

Parameter

Type

Required

Example

Description

clientInfo

JSONObject

No

{"userId":"120234234","userNick":"Mike","userType":"others"}

The client information serialized from the ClientInfo structure in JSON format, including the unique machine identifier (UMID) and International Mobile Equipment Identity (IMEI) of the client. For more information, see ClientInfo.

bizType

String

No

edu

The business scenario type.

personId

String

Yes

person1

The ID of the individual. To get all individual IDs, call the /green/sface/group/persons operation.

urls

StringArray

Yes

["http://xxx/xxx01.jpg","http://xxx/xxx02.jpg"]

The URLs of the face images to add.

Response parameters

All responses are returned in JSON format. For common response parameters, see Common response parameters. The data field returns business-specific data as a JSON object or array.

The data field may be empty when an error occurs.

The following table describes the fields in the data object.

Field

Type

Example

Description

code

Integer

200

The HTTP status code. For more information, see Common error codes.

groupIds

StringArray

["foreign1"]

The IDs of the face groups to which the individual belongs.

personId

String

person1

The ID of the individual.

faceImageItems

JSONArray

—

The results for each face image submitted. For details, see the faceImageItem structure below.

faceImageItem structure

Field

Type

Example

Description

faceId

Float

23088737259260929

The ID of the recognized face.

success

Boolean

true

Specifies whether the face image was added successfully. Valid values: true | false.

Examples

Request

POST /green/sface/face/add HTTP/1.1
Common request headers
{
    "personId": "person1",
    "urls": [
        "http://xxx/xxx01.jpg",
        "http://xxx/xxx02.jpg"
    ]
}

Response

{
    "msg": "OK",
    "code": 200,
    "requestId": "36D384DA-8023-4E84-BCFD-0C5581352C16",
    "data": {
        "code": 200,
        "groupIds": [
            "foreign1"
        ],
        "personId": "person1",
        "faceImageItems": [
            {
                "success": true,
                "faceId": 23088737259260929
            }
        ]
    }
}

Error codes

For a list of error codes, see Service error codes.