@Pitou That’s a great question. Photos are a RESTful resource that can be managed like any other API resource. That is to say, a photo is not much different than a Point
or a PinBinding
. On the production server, they are stored in Google Cloud Storage. For self-hosters, the photos are stored to disk.
I’ve provided 3 examples below:
- Retrieve all images
- Retrieve a single image
- Delete a single image
To run the examples below, you will need to put an auth token in your authorization header. You will also need a reliable HTTP client for whatever programming language you decide to build your image management tool with.
Retrieve All Images
Perform an HTTP GET to my.farm.bot/api/images
The response will look like this:
[
{
"id": 6,
"created_at": "2019-11-07T15:01:17.999Z",
"updated_at": "2019-11-07T15:01:17.999Z",
"device_id": 249,
"attachment_processed_at": null,
"attachment_url": "https://i.imgur.com/EBhHoye.jpg",
"meta": {
"x": 1,
"y": 2,
"z": 3
}
}
]
Delete Image with ID of 3
Perform an HTTP DELETE request to my.farm.bot/api/images/3
The server will return an empty response.
Retrieve a single Image with ID of 4
GET /api/images/4
Perform an HTTP GET to my.farm.bot/api/images/4
The response will look like this:
{
"id": 4,
"created_at": "2019-11-07T15:01:17.954Z",
"updated_at": "2019-11-07T15:01:17.954Z",
"device_id": 248,
"attachment_processed_at": null,
"attachment_url": "https://i.imgur.com/EBhHoye.jpg",
"meta": {
"x": 1,
"y": 2,
"z": 3
}
}