Sites API
Sites API provides HTTP API to handle sites' objects.
Create Site CloudGateway
POST /v3/sites
Creates a new site with provided parameters and returns created site object.
Request
$ curl -X POST \
http://api.enapter.com/v3/sites \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"name": "Test Site",
"timezone": "UTC"
}'
Body Parameters
namestringrequired#Name for the new site.
timezonestringrequired#Timezone for the new site.
locationobject#Locationobject.Location.namestring#Location name for the new site.
Location.latitudefloat#Location latitude for the new site.
Location.longitudefloat#Location longitude for the new site.
Response
Information about created site:
{
"site": {
"id": "fecbbba0-79f2-4e9e-a6f0-69a310ab110b",
"name": "Test Site",
"timezone": "UTC",
"version": "V3",
"authorized_role": "INSTALLER",
"archived": false
}
}
siteobject#Siteobject contains site information.Site.idstring#ID of the site.
Site.namestring#Name of the site.
Site.timezonestring#Timezone of the site.
Site.locationobject#The site location information.
location.namestring#Location name of the site.
location.latitudefloat#Location latitude of the site.
location.longitudefloat#Location longitude of the site.
Site.archivedboolean#Site is archived. See Archive Site reference for more details.
Site.authorized_rolestring#User authorized role for the site. See authorization system for more details.
Site.versionstring#Version of the site. Should be always
V3at now.
Get Site CloudGateway
GET /v3/sites/{site_id}
Returns information about site with site_id.
Gateway has a single site and it has a shortcut API GET /v3/site.
Request
$ curl http://api.enapter.com/v3/sites/fecbbba0-79f2-4e9e-a6f0-69a310ab110b
Response
Retrieved site:
{
"site": {
"id": "fecbbba0-79f2-4e9e-a6f0-69a310ab110b",
"name": "Test Site",
"timezone": "UTC",
"version": "V3",
"authorized_role": "INSTALLER",
"archived": false,
"location": {
"name": "Berlin",
"latitude": 52.520008,
"longitude": 13.404954
}
}
}
siteobject#Siteobject contains site information.Site.idstring#ID of the site.
Site.namestring#Name of the site.
Site.timezonestring#Timezone of the site.
Site.locationobject#The site location information.
location.namestring#Location name of the site.
location.latitudefloat#Location latitude of the site.
location.longitudefloat#Location longitude of the site.
Site.archivedboolean#Site is archived. See Archive Site reference for more details.
Site.authorized_rolestring#User authorized role for the site. See authorization system for more details.
Site.versionstring#Version of the site. Should be always
V3at now.
Update Site CloudGateway
PATCH /v3/sites/{site_id}
Updates site information. You should be an OWNER at least to do this.
Gateway has a single site and it has a shortcut API PATCH /v3/site.
Request
$ curl -X PATCH \
http://api.enapter.com/v3/sites/fecbbba0-79f2-4e9e-a6f0-69a310ab110b \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"timezone": "Europe/Berlin",
"location": {
"latitude": 52.520008,
"longitude": 13.404954
}'
It is also possible to reset some fields:
$ curl -X PATCH \
http://api.enapter.com/v3/sites/fecbbba0-79f2-4e9e-a6f0-69a310ab110b \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"timezone": "Europe/Berlin",
"_reset" ["location.name"]
}'
Body Parameters
namestring#The new name for the site.
timezonestring#The new timezone for the site.
locationobject#Locationobject.location.namestring#The new location name for the site.
location.latitudefloat#The new location latitude for the site.
location.longitudefloat#The new location longitude for the site.
_resetarray of strings#The list of fields to reset. Available values:
location.name, location.latitude, location.longitude.
Response
Updated site:
{
"site": {
"id": "fecbbba0-79f2-4e9e-a6f0-69a310ab110b",
"name": "Test Site",
"timezone": "Europe/Berlin",
"version": "V3",
"authorized_role": "INSTALLER",
"archived": false
}
}
siteobject#Siteobject contains site information.Site.idstring#ID of the site.
Site.namestring#Name of the site.
Site.timezonestring#Timezone of the site.
Site.locationobject#The site location information.
location.namestring#Location name of the site.
location.latitudefloat#Location latitude of the site.
location.longitudefloat#Location longitude of the site.
Site.archivedboolean#Site is archived. See Archive Site reference for more details.
Site.authorized_rolestring#User authorized role for the site. See authorization system for more details.
Site.versionstring#Version of the site. Should be always
V3at now.
List Sites CloudGateway
GET /v3/sites
Returns all sites available to the user.
It does not make any sense to get sites list on Gateway, because it has only single site. It simpler to get this single site via GET /v3/site.
Request
$ curl http://api.enapter.com/v3/sites
Query Parameters
limitnumber#The maximum number of sites to return.
offsetnumber#The number of sites to skip. Sites ordered by ID.
name.containsstring#Filter sites by name.
archived_statestringdefault: ACTIVE#Filter sites by archived state:
ACTIVE— list only active (non-archived sites)ARCHIVED— list only archived sitesALL— list sites whether they are active or archived.
Response
List of sites:
{
"sites": [
{
"id": "fecbbba0-79f2-4e9e-a6f0-69a310ab110b",
"name": "Test Site",
"timezone": "UTC",
"version": "V3",
"authorized_role": "INSTALLER",
"archived": false
},{
"id": "69a3110b-6ff2-fba0-a079-4eecbb9e0ab1",
"name": "Our Factory",
"timezone": "Europe/Berlin",
"version": "V3",
"authorized_role": "USER",
"archived": false,
"location": {
"name": "Berlin",
"latitude": 52.520008,
"longitude": 13.404954
}
}
],
"total_count": 2
}
total_countinteger#The total number of all available user's sites. It can be bigger than count of sites in reponse in case of
total_countbigger thanlimitfrom request.
sitesarray of objects#A list of
Siteobjects.siteobject#Siteobject contains site information.Site.idstring#ID of the site.
Site.namestring#Name of the site.
Site.timezonestring#Timezone of the site.
Site.locationobject#The site location information.
location.namestring#Location name of the site.
location.latitudefloat#Location latitude of the site.
location.longitudefloat#Location longitude of the site.
Site.archivedboolean#Site is archived. See Archive Site reference for more details.
Site.authorized_rolestring#User authorized role for the site. See authorization system for more details.
Site.versionstring#Version of the site. Should be always
V3at now.
Delete Site CloudGateway
DELETE /v3/sites/{site_id}
Deletes site. You should be an OWNER at least to do this.
Request
$ curl -X DELETE
http://api.enapter.com/v3/sites/fecbbba0-79f2-4e9e-a6f0-69a310ab110b
Query Parameters
skip_check_existenceboolean#Return OK status if site does not exist.
Archive Site CloudGateway
POST /v3/sites/{site_id}/archive
Archive site. You should be an OWNER at least to do this.
Archived sites are not listed by default. Use archived_state filter to show them.
Request
$ curl -X POST
http://api.enapter.com/v3/sites/fecbbba0-79f2-4e9e-a6f0-69a310ab110b/archive
Query Parameters
skip_check_existenceboolean#Return OK status if site does not exist.