Metadata · Standard API · eKYC Core
Update metadata
Adds metadata, and optionally a label, to an uploaded image, and returns the image's latest label and metadata.
Request
{image_id} in the path is the id of the image the metadata is attached to.
| Name | Type | Required | Description |
|---|---|---|---|
metadata | dictionary | Required | key-value, key should be string, value should be string, int, float, bool |
label | string | Optional | label of the image as described at Label table |
override | bool | Optional | flag to allow override old metadata or not |
{
"metadata": dictionary,
"label": string,
"override": bool,
}
Sample request
curl -X PATCH \
https://tv-staging.trustingsocial.com/api/v1/images/a4facba3-334b-41fb-97e3-4766cb70ae29 \
-H 'Authorization: TV <YOUR ACCESS KEY>:<CREATED SIGNATURE>' \
-H 'X-TV-Timestamp: 2019-04-21T18:00:15+07:00' \
-H 'Content-Type: application/json' \
-d \
'
{
"metadata": {
"national_id": "123456789"
}
}
'
Response
The response is a JSON body in the shape below; the errors array follows the shared response envelope.
{
"data": {
"image_id": string, // ID of the uploaded image in DB
"label": string, // Label of the uploaded image
"metadata": dictionary, // Metadata of the uploaded image
},
"errors": [
{
"code": string,
"message": string,
"detail": {
"field": string, // optional, which parameter is invalid.
... // any other information that can be useful for client
},
},
... // other errors
]
}
In case of success, the HTTP status code will be 200, and the data will be an object containing following fields:
| field | type | description |
|---|---|---|
image_id | string | ID of the uploaded image (UUID) |
label | string | latest label of the image |
metadata | dictionary | latest metadata of the image |
An image that now carries a portrait label and two metadata keys:
{
"data": {
"image_id": "b35acc59-eefb-44fb-a6eb-ea02cec42cfc",
"label": "portrait",
"metadata": {
"app_id": "5555",
"national_id": "6666"
}
}
}
Failure codes
In case of error, the data will be empty, and server sends following HTTP status code and error information:
| HTTP code | Error code | Description |
|---|---|---|
401 | access_denied_exception | You are not authorized to perform the action. |
400 | invalid_parameter_exception | Input parameter violates a constraint. |
404 | image_not_found_exception | The image ID is not found in DB. |
408 | request_timeout_exception | Request takes too long to process |
429 | rate_limit_exception | The number of requests exceeded your throughput limit. |
500 | internal_server_error | Some unexpected error occurs while processing the request |
The codes above are the ones documented for this endpoint. Response errors on the Overview lists the codes for the eKYC Core surface as a whole — the two lists do not match on every endpoint.