Перейти к основному содержимому

# Motion control patterns

Motion control pattern is a list of actions that the user should perform with their head when recording a motion control video.

There must be at least one pattern to record a motion control video. If there is more than one pattern, they will alternate in random order excluding the previous one.

### Get a list of patterns​

Endpoint: GET /publicapi/api/v2/private/ActiveLivenessPattern

    curl -X 'GET' \
      'http://baf.ai/publicapi/api/v2/private/ActiveLivenessPattern' \
      -H 'accept: text/plain' \
      -H 'Authorization: Bearer sk_e291909c-687f-43b7-b234-216681350c6c'

Response example:

Status Code | 200

    {
      "patterns": [
        {
          "id": "2ce689c9-a02d-4a24-b93f-39215b5c2b43",
          "pattern": [
            "closer",
            "up",
            "farther",
            "left"
          ],
          "externalLink": "string",
          "creationDate": "2024-02-08T10:01:43.014961Z",
          "lastModified": "2024-02-08T10:01:43.014961Z"
        }
      ]
    }

### Create a pattern​

Endpoint: POST /publicapi/api​/v2​/private/ActiveLivenessPattern

Request body:

    [
      "up",
      "right"
    ]

The input is a list of actions to be performed by the user. The order is maintained.

List of possible actions:

- up — turn face up
- right — turn face to the right
- left — turn face to the left
- closer — bring face closer to the camera
- farther — bring face away from the camera

Minimum number of actions is 1, maximum is 5.

Request example:

    curl -X 'POST' \
      'http://baf.ai/publicapi/api/v2/private/ActiveLivenessPattern' \
      -H 'accept: text/plain' \
      -H 'Authorization: Bearer sk_e291909c-687f-43b7-b234-216681350c6c' \
      -H 'Content-Type: application/json-patch+json' \
      -d '[
      "up",
      "right"
    ]'

Response example:

Status Code | 200

    {
      "id": "038237f8-702a-49ea-88da-84b3d43fc055",
      "pattern": [
        "up",
        "right"
      ],
      "externalLink": "28608d66-a571-44ec-94db-04a00143ff51",
      "creationDate": "2024-02-12T04:32:25.018985Z",
      "lastModified": "2024-02-12T04:32:25.018985Z"
    }

### Delete a pattern​

Endpoint: DELETE /publicapi/api/v2/private/ActiveLivenessPattern/{patternId}

Parameters:

patternId

Request example:

    curl -X 'DELETE' \
      'http://baf.ai/publicapi/api/v2/private/ActiveLivenessPattern/038237f8-702a-49ea-88da-84b3d43fc055' \
      -H 'accept: */*' \
      -H 'Authorization: Bearer sk_e291909c-687f-43b7-b234-216681350c6c'

Response example:

Status Code | 200