Skip to content

Structure of Requests and Responses

The ampliFi API provides a collection of methods in the form of microservices available through a set of REST endpoints. These methods can be accessed directly from your program code, and requests are made using the http verbs GET, PUT, POST, and DELETE. This section describes some elements that are common to most, if not all, of the ampliFi API calls. These elements are not discussed in the individual descriptions unless necessary.

Requests

Each method is invoked by an http request to an API endpoint using one of the verbs GET, PUT, POST or DELETE. Path parameters may be encoded in the URL, but query parameters are not used.

Most POST and PUT requests provide a request body in JSON format. When a JSON format request body is required, the Content-Type header should be application/json. For GET requests, the request body is empty, but path parameters encoded in the URL may be necessary. Date-time strings are given in ISO 8601 format, and their names are prefixed with "dts".

The format for calling each API is given in the individual descriptions. For example, the call to the ping endpoint is given as

GET /ping/heartbeat

Using the cURL command line package this could be called as

curl --location --request GET http://{url}/ping/heartbeat

where {url} is the URL for the ampliFi server.

Responses

Each request returns a status code, along with a set of standard http headers which may be ignored. In some cases a response body is also returned in JSON format.

If the call succeeds, the response body includes the element "success": true and the status code is 200 or 201. If the call fails, the status code is 300 or greater, and the response body gives an appropriate message.