The Agent daemon supports a local API with REST-like endpoints as well as WebSockets.
This endpoint provides the current JSON configuration string for the requesting container. Containers identify themselves by their element ID, which is mapped into the container as an environment variable.
http://iofog:54321/v2/config/get
{
"status": "okay",
"config": "{\"property1\":\"value1\",\"property2\":\"value2\"}"
}None
{
"id": "R4b2WPZRbycCzyZBz9tD7BdMWg94YDhQ"
// Note: The POST value is JSON and must be sent
// with HTTP header set as “Content-Type:application/json”
}This endpoint opens a control Websocket connection for the container. The control commands sent over this Websocket are specified here. It is the responsibility of the container to establish this connection and ensure it is always running. If the container loses the Websocket connection, it should establish a new connection. The Local API is responsible for knowing which Websocket connection belongs to which container so that it can pass information to the appropriate recipients.
The container ID must be passed as part of the URL because otherwise it would have to be passed in the Websocket connection itself and that would make associated connections with container IDs rather difficult.
ws://iofog:54321/v2/control/socket/id/34t9whefsdfDFKjhw4tiouhwef
None - the Websocket will simply be opened successfully
id - the container ID of the container requesting the Websocket connection (example shown here as 34t9whefsdfDFKjhw4tiouhwef)
NoneStandard "Ping" message (op code 9) Standard "Pong" message (op code 10) Acknowledgement message (op code 11) New container configuration available (op code 12)
Standard "Ping" message (op code 9) Standard "Pong" message (op code 10) Acknowledgement message (op code 11)
This endpoint return service status, same as cli command iofog-agent status.
http://iofog:54321/v2/status
GET
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
{
"running-microservices": "string",
"system-total-cpu": "string",
"memory-usage": "string",
"system-available-memory": "string",
"system-time": "string",
"disk-usage": "string",
"connection-to-controller": "string",
"cpu-usage": "string",
"messages-processed": "string",
"system-available-disk": "string",
"iofog-daemon": "string"
}None
This endpoint return service info, same as cli command iofog-agent info.
http://iofog:54321/v2/info
GET
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
{
"log-file-directory": "string",
"iofog-controller": "string",
"cpu-usage-limit": "string",
"developer-mode": "string",
"post-diagnostics-frequency": "string",
"docker-url": "string",
"status-update-frequency": "string",
"memory-ram-limit": "string",
"log-disk-limit": "string",
"isolated-docker-containers-mode": "string",
"iofog-certificate": "string",
"ip-address": "string",
"network-interface": "string",
"fog-type": "string",
"disk-usage-limit": "string",
"iofog-uuid": "string",
"gps-mode": "string",
"message-storage-directory": "string",
"get-changes-frequency": "string",
"gps-coordinates": "string",
"log-rolling-file-count": "string",
"scan-devices-frequency": "string",
"log-level": "string",
"docker-pruning-frequency": "string",
"disk-threshold integer": "string"
}None
This endpoint return service version, same as cli command iofog-agent version.
http://iofog:54321/v2/version
GET
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
{
"version": "3.0.0"
}None
This endpoint attaches ioFog Agent to the configured ioFog controller, same as cli command iofog-agent provision <provisioning_key>.
http://iofog:54321/v2/provision
POST
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
SuccessNone
{
"provisioning-key": "string"
}This endpoint detaches ioFog Agent to the configured ioFog controller, same as cli command iofog-agent deprovision.
http://iofog:54321/v2/deprovision
DELETE
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
SuccessNone
This endpoint changes ioFog Agent configuration according to the options provided, same as cli command iofog-agent config.
http://iofog:54321/v2/config
POST
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
SuccessNone
{
"disk-limit": "string",
"disk-directory": "string",
"memory-limit": "string",
"cpu-limit": "string",
"controller-url": "string",
"cert-directory": "string",
"docker-url": "string",
"network-adapter": "string",
"logs-limit": "string",
"logs-directory": "string",
"logs-count": "string",
"status-frequency": "string",
"changes-frequency": "string",
"diagnostics-frequency": "string",
"device-scan-frequency": "string",
"isolated": "string",
"gps": "string",
"fog-type": "string",
"developer-mode": "string",
"log-level": "string",
"docker-pruning-frequency": "string",
"disk-threshold integer": "string"
}None
This endpoint prunes ioFog Agent, same as cli command iofog-agent prune.
http://iofog:54321/v2/prune
POST
Authorization (authorization key can be found in /etc/iofog-agent/local-api file)
Success