Endpoints
Available Endpoints
There are four REST endpoints representing actions available on the API
- Initialise
- Open Drawer
- Close Drawer
- Take Image
Initialise
The ColonyCam should be initialised before it runs any other operation or task. This process homes all of the motors and readies the ColonyCam for use. Initialisation should be performed.
- When the ColonyCam is powered up.
- When the ColonyCam needs to recover from an error.
Initialisation can be invoked using
http://<server address>/v1/initialise
This will then return a JSON structure which can be used to determine the result of the initialisation. This has the pattern
{
"result":"Initialised",
"machineName":"ColonyCam-1",
"softwareVersion":"1.0.0",
"firmwareVersion":"1.0.0"
}
Once ColonyCam has been initialised then other commands can be invoked.
Open Drawer
This process opens the drawer of the ColonyCam unit. This should only be invoked.
- When the ColonyCam is powered up.
- When the ColonyCam has been initialised.
- When the ColonyCam is not in an error state.
- When the ColonyCam drawer is in the closed position.
Open Drawer can be invoked using
http://<server address>/v1/open-drawer
This will then return a JSON structure which can be used to determine the result of the open drawer operation. This has the pattern
{
"result":"Opened"
}
If this endpoint is invoked when the drawer is already in the open position no operation will be performed and the JSON returned will be the same.
Close Drawer
This process closes the drawer of the ColonyCam unit. This should only be invoked.
- When the ColonyCam is powered up.
- When the ColonyCam has been initalised. When the ColonyCam is not in an error state.
- When the ColonyCam drawer is in the open position.
Close Drawer can be invoked using
http://<server address>/v1/close-drawer
This will then return a JSON structure which can be used to determine the result of the close drawer operation. This has the pattern
{
"result":"Closed"
}
If this endpoint is invoked when the drawer is already in the closed position no operation will be performed and the JSON returned will be the same.
Take Image
This process takes an image from the ColonyCam unit. This should only be invoked.
- When the ColonyCam is powered up.
- When the ColonyCam has been initalised.
- When the ColonyCam is not in an error state.
- When the ColonyCam drawer is in the closed position.
Take Image can be invoked using
http://<server address>/v1/image
This will then return an image represented as a byte array.