Get Sites
1. Introduction
Site information is an important part of the MyQ Central server. With the /v2/sites
endpoint your application can get all the information about the available sites that are configured in your Central server. One example use case is filtering and connecting to the right site server as a client moving between networks by requesting a site server based on the client's network IP range.
2. Prerequisites
You will need a MyQ Central server with some sites already configured and REST API application in MyQ → Settings → External Systems. No scopes are required.
3. Calling the API
The endpoint is defined as:
Endpoint:
GET /v2/sites
Authentication:
Grant_type: client_credentials
Scopes: []
Headers:
Content-Type: application/json
Authentication: Bearer %access_token%
Body:
{}
Note that the %access_token%
needs to be replaced by the token you received as a response from auth endpoint.
3.1. Filtering the sites
Example request:
GET /v2/sites?status=ok&client_ip=192.168.1.10-20&error=false
There are three GET parameters that can filter the resulted sites. Calling the endpoint with no parameters returns all sites present on the Central server.
Available filter parameters are:
status
- Site status, Available values: ok, unreachable, errorclient_ip
- Filter sites which have given address defined in its rangeserror
- Filter sites with/without replications error
4. Response
The endpoint returns a list of sites according to the filter. More can be found in Central Server API endpoints.