Skip to content

Commit

Permalink
Merge pull request #149 from eduardogmisiuk/update_docs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
eduardogmisiuk committed Apr 28, 2020
2 parents 316602c + 340ce4c commit c346068
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
52 changes: 25 additions & 27 deletions docs/apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ Get the full list of templates with all their associated attributes.
{
"message": "At least one entry per page is mandatory",
"status": 400
}
}

+ Response 400 (application/json)

{
"message": "page_size and page_num must be integers",
"status": 400
}
}

### Delete all templates [DELETE /template]
Removes all templates. If any device is based on the template being removed, an error message is returned.
Expand Down Expand Up @@ -281,7 +281,7 @@ Removes all templates. If any device is based on the template being removed, an
{
"message": "Templates cannot be removed as they are being used by devices",
"status": 404
}
}

## Template info [/template/{id}]
Access a specific template
Expand Down Expand Up @@ -481,7 +481,7 @@ All devices based on this template will be also updated.
"status": 404
}

### Delete template [DELETE /template/{id}]
### Delete template [DELETE /template/{id}]
Removes a template. If any device is based on the template being removed, then all its attributes will be also removed.

+ Request
Expand Down Expand Up @@ -594,14 +594,14 @@ which describes all the attributes to be applied to this device.
{
"message": "Verbose can only be used for single device creation",
"status": 400
}
}

+ Response 400 (application/json)

{
"message": "Payload must be valid JSON, and Content-Type set accordingly",
"status": 400
}
}

+ Response 400 (application/json)

Expand All @@ -621,14 +621,14 @@ which describes all the attributes to be applied to this device.
"a device can not have repeated attributes"
],
"status": 400
}
}

+ Response 404 (application/json)

{
"message": "No such template: 1",
"status": 404
}
}

+ Response 500 (application/json)

Expand Down Expand Up @@ -713,7 +713,7 @@ In this example, there is only one template (ID 4865).
+ Parameters
+ page_size: 20 (integer, optional)
+ page_num: 1 (integer, optional)
+ idsOnly: false (booelan, optional) - Return only the ids of all existing devices. Ignores any `page_size` and `page_num` configurations
+ idsOnly: false (boolean, optional) - Return only the IDs of the devices (paginated).
+ attr: foo=bar (string, optional) - Return only devices that posess a given attribute's value
+ attr_type: geopoint (string, optional) - Return only devices with attributes of a particular type.
+ label: dummy (string, optional) - Return only devices that are named accordingly (prefix or suffix match)
Expand Down Expand Up @@ -803,14 +803,14 @@ In this example, there is only one template (ID 4865).
{
"message": "At least one entry per page is mandatory",
"status": 400
}
}

+ Response 400 (application/json)

{
"message": "page_size and page_num must be integers",
"status": 400
}
}

### Get the current list of devices associated with given template [GET /device/template/{template_id}{?page_size,page_num}]
Get the full list of devices that belong to a given template..
Expand Down Expand Up @@ -893,14 +893,14 @@ Get the full list of devices that belong to a given template..
{
"message": "At least one entry per page is mandatory",
"status": 400
}
}

+ Response 400 (application/json)

{
"message": "page_size and page_num must be integers",
"status": 400
}
}

### Update device info [PUT]
Updates a device's configuration
Expand Down Expand Up @@ -956,7 +956,7 @@ Updates a device's configuration
{
"message": "Payload must be valid JSON, and Content-Type set accordingly",
"status": 400
}
}

+ Response 400 (application/json)

Expand All @@ -976,7 +976,7 @@ Updates a device's configuration
"a device can not have repeated attributes"
],
"status": 400
}
}

+ Response 404 (application/json)

Expand All @@ -990,7 +990,7 @@ Updates a device's configuration
{
"message": "No such template: 4865",
"status": 404
}
}

+ Response 400 (application/json)

Expand All @@ -1011,7 +1011,7 @@ Updates a device's configuration
{
"message": "Unknown metadata attribute 2 in override list",
"status": 400
}
}


### Configure device [PUT /device/{deviceid}/actuate]
Expand All @@ -1028,7 +1028,6 @@ The target attribute must be of type "actuator".
+ Body

{
"topic": "/admin/efac/config",
"attrs": {
"battery" : 10.6
}
Expand All @@ -1046,15 +1045,15 @@ The target attribute must be of type "actuator".
{
"message": "No such device: aaaa",
"status": 404
}
}

+ Response 403 (application/json)

{
"attrs": [
"temperature"
],
"status": "some of the attributes are not configurable"
"status": "some of the attributes are not configurable"
}


Expand Down Expand Up @@ -1255,7 +1254,7 @@ Calling this endpoint twice with the same target attributes will override the pr
"message": "Some attribute is not a 'psk' type_value",
"status": 400
}

### Copy PSK [PUT /device/{device_id}/attrs/{attr_label}/psk{?from_dev_id,from_attr_label}]
Copies a generated pre-shared key from a device's attribute to other device's attribute.

Expand All @@ -1272,7 +1271,7 @@ previously copied from it.
+ `attr_label`: `shared_key` (string, required) - The destination attribute where the key is copied to
+ `from_dev_id`: `efac` (string, required) - The source device where the base attribute lives
+ `from_attr_label`: `shared_key` (string, required) - The source attribute where the key is copied from

+ Request

+ Headers
Expand All @@ -1293,15 +1292,14 @@ previously copied from it.
{
"message": "Not found attributes key",
"status": 404

}

+ Response 400 (application/json)

{
"message": "Missing mandatory parameter: from_dev_id or/and from_attr_label",
"status": 400
}
}

+ Response 400 (application/json)

Expand All @@ -1317,7 +1315,7 @@ previously copied from it.
"message": "There is not a psk generated to key",
"status": 400
}


# Group Internal
Internal endpoins must not be expose outside the platform. They are used to
Expand Down Expand Up @@ -1396,7 +1394,7 @@ In this example, there is only one template (ID 1).
+ Parameters
+ page_size: 20 (integer, optional)
+ page_num: 1 (integer, optional)
+ idsOnly: false (booelan, optional) - Return only the ids of all existing devices. Ignores any `page_size` and `page_num` configurations
+ idsOnly: false (boolean, optional) - Return only the IDs of the devices (paginated).
+ attr: foo=bar (string, optional) - Return only devices that posess a given attribute's value
+ label: dummy (string, optional) - Return only devices that are named accordingly (prefix or suffix match)
+ sortBy: label (string, optional) - Return entries sorted by given field. Currently only `label` is supported.
Expand Down Expand Up @@ -1480,7 +1478,7 @@ In this example, there is only one template (ID 1).
{
"message": "At least one entry per page is mandatory",
"status": 400
}
}

+ Response 400 (application/json)

Expand Down
4 changes: 2 additions & 2 deletions tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
restart: always

postgres-users:
image: postgres:9.4.24-alpine
image: dojot/postgres:9.4.24-alpine
restart: on-failure
command: >
bash -c "createuser kong -d -h postgres -U postgres && createdb kong -U kong -h postgres"
Expand All @@ -26,7 +26,7 @@ services:
max-size: 100m

postgres:
image: postgres:9.4.24-alpine
image: dojot/postgres:9.4.24-alpine
restart: always
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
Expand Down

0 comments on commit c346068

Please sign in to comment.