/assets/upload
Stores an image in the database. Only JPEG, PNG or BMP images are accepted; any other content is rejected with 400. The collection collectionId must exist. The image becomes associated with a specimen when it is created with POST /faces. The file field is sent as a binary file in a multipart/form-data part, like any other field of an HTML form with a file input - it is not a text field and does not require encoding (neither base64 nor hexadecimal).
Example with curl:
curl -F "[email protected]" -F "collectionId=bank01_collection01" -F "mimeType=image/jpeg" http://127.0.0.1:6982/assets/uploadJWT signed with HS256 (shared secret auth_jwt_secret) and with a non-expired exp claim; if it includes nbf, it must be currently valid. Only applied if auth_enabled is true and auth_accept_authorization_header is true. The Bearer scheme is case-insensitive.
Body for the asset upload request in multipart/form-data
Binary image data in JPEG, PNG or BMP format, sent or received as is (not encoded in base64 or in any other text format).
An identifier that allows grouping different images or biometric templates in a common space. It can only contain ASCII letters (A-Z, a-z), digits (0-9), underscore (_) and hyphen (-); it cannot be empty and it is case-sensitive. The following are not allowed: spaces, dots, +, :, @, quotes, %, ~, /, or non-ASCII characters (ñ, accents, emoji...): the identifier is used as a path parameter and any other character prevents its use. It must correspond to a collection previously created with POST /collections.
bank01_collection01Pattern: ^[A-Za-z0-9_-]+$Identifier of the file format (image/jpeg, image/png or image/bmp). If not included, it defaults to 'image/jpeg'. It is the value that will be returned as Content-Type when the image is downloaded.
image/jpegThe result of the upload.
Media upload response. The identifier is returned in id (elsewhere in the API this same value is called mediaId).
An identifier of an image in the database. Each image is associated with a single specimen (face): the uploaded image becomes associated when the face is created with POST /faces and it is deleted together with it (DELETE /faces/{Id}) or together with its collection (DELETE /collections/{collectionId}).
9c79c818-b81a-4959-b65a-a2b0c8143528Incorrect parameters arrive in the request.
JWT authentication is enabled and the token is missing or invalid.
The request body exceeds client_max_body_size. It is returned with no body and the connection is closed.
An error occurred while calling the backend.
POST /assets/upload HTTP/1.1
Host: 127.0.0.1:6982/
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 78
{
"file": "binary",
"collectionId": "bank01_collection01",
"mimeType": "image/jpeg"
}{
"id": "9c79c818-b81a-4959-b65a-a2b0c8143528"
}Atualizado