Setting metadata value
Learn how to update the collection using the Alphamoon's API
Alphamoon's API lets you update collections with metadata in just a few clicks.
Let's say you want to indicate that the given collection has already been printed. In this case, you can use the endpoint below to include such information in the server response:
Update collection by ID
PATCH
/api/v0.3/collections/{collection_id}
Path parameters
collection_id*
String
The ID of the selected collection.
You can get the collection_id from:
Upload a file endpoint (Base64 or Binary)
Get collections endpoint
URL e.g. https://workspace.alphamoon.ai/supervision/223742cc9bca43fd81b2d41b0018e4c7
Request body*
Add your metadata in the request body. For the purposes of this tutorial, let's stick with the printing example. Our metadata will be as follows:
{
"metadata": {"printed": "yes"}
}
{
"id": "191719e01ae84f02993168ef95be3c49",
"name": "Invoice example.pdf",
"files": [
{
"id": "0164f04d3a1e4138b73bb84695395871",
"collectionId": "191719e01ae84f02993168ef95be3c49",
"name": "Invoice example.pdf",
"status": "Accepted",
"progress": 100,
"numberOfPages": 1,
"createdAt": "2024-04-15T15:03:38Z",
"updatedAt": "2024-04-16T12:29:07Z",
"metadata": {}
}
],
"priority": false,
"split": false,
"status": "Accepted",
"progress": 100,
"numberOfPages": 1,
"processId": "93580f176efb48cda64f25cba74d8ca4",
"createdAt": "2024-04-15T15:03:38Z",
"updatedAt": "2024-04-29T12:07:54Z",
"metadata": {
"printed": "yes"
},
"availableForTraining": true,
"duplicates": []
}
See the example:
curl -X 'PATCH' \
'https://workspace.alphamoon.ai/api/v0.3/collections/191719e01ae84f02993168ef95be3c49' \
-H 'accept: application/json' \
-H 'Authorization: Basic API_KEY_BASE64_ENCODED' \
-H 'Content-Type: application/json' \
-d '{
"metadata": {"printed": "yes"}
}'
See next:
Last updated