Images
List All Images Associated With My Twin
§List All Images Associated With My Twin
To view all images that are associated with your twin, you can send a GET request to the /images/ URL.
An example request would look like the following:
curl --location --request GET '<API_URL>/images/' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
Below is an example response:
{
"links": {
"first": "https://api.fetch.ai/images/?page_number=1",
"last": "https://api.fetch.ai/images/?page_number=1",
"next": null,
"prev": null
},
"data": [],
"meta": {
"pagination": {
"page": 1,
"pages": 1,
"count": 0
}
}
}
§Add An Image To My Twin
To add an image to your twin, you send a POST request to the /images/ URL and include the base64 encoded string for the image in the body data as shown below:
curl --location --request POST '<API_URL>/images/' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>' \
--data-raw '{
"data": {
"type": "images",
"attributes": {
"media": "<BASE64_STRING>"
}
}
}
§Delete An Image
curl --location --request DELETE '<API_URL>/images/<IMG_ID>' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>' \
--data-raw ''