API examples
parent
5d96d0810e
commit
d6ce043a56
568
api_docs.md
568
api_docs.md
|
@ -4,7 +4,11 @@
|
|||
### Request
|
||||
|
||||
```
|
||||
{"format"=>"json", "controller"=>"api/devices", "action"=>"index"}
|
||||
{
|
||||
"format": "json",
|
||||
"controller": "api/devices",
|
||||
"action": "index"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -12,10 +16,10 @@
|
|||
```
|
||||
[
|
||||
{
|
||||
"_id": "557828fa766f6c33e41e0000",
|
||||
"name": "orval.schumm",
|
||||
"uuid": "24f8a32f-975a-47b4-be52-c4e4be9d5596",
|
||||
"token": "iZD3dj_kl7YG5OQt7Qeg3w"
|
||||
"_id": "557829b2766f6c350d200000",
|
||||
"name": "makayla_yost",
|
||||
"uuid": "7b1ebadd-aa1f-4e07-9829-f81f7ebc5108",
|
||||
"token": "qj5UVWLDFa4m_WbNi6f61g"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
@ -27,14 +31,21 @@
|
|||
### Request
|
||||
|
||||
```
|
||||
{"user_id"=>"557828ff766f6c33e49e0000", "name"=>"Frank", "uuid"=>"123", "token"=>"321", "controller"=>"api/devices", "action"=>"create"}
|
||||
{
|
||||
"user_id": "557829b5766f6c350d7b0000",
|
||||
"name": "Frank",
|
||||
"uuid": "123",
|
||||
"token": "321",
|
||||
"controller": "api/devices",
|
||||
"action": "create"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828ff766f6c33e4a00000",
|
||||
"_id": "557829b5766f6c350d7d0000",
|
||||
"name": "Frank",
|
||||
"uuid": "123",
|
||||
"token": "321"
|
||||
|
@ -42,34 +53,19 @@
|
|||
```
|
||||
|
||||
|
||||
# PUT /api/devices/557828fc766f6c33e4810000
|
||||
# DELETE /api/devices/557829b2766f6c350d220000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"name"=>"Dimitri Altenwerth", "id"=>"557828fc766f6c33e4810000", "controller"=>"api/devices", "action"=>"update"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828fc766f6c33e4810000",
|
||||
"name": "Dimitri Altenwerth",
|
||||
"uuid": "24f8a32f-975a-47b4-be52-c4e4be9d5596",
|
||||
"token": "iZD3dj_kl7YG5OQt7Qeg3w"
|
||||
"fromat": "json",
|
||||
"id": "557829b2766f6c350d220000",
|
||||
"controller": "api/devices",
|
||||
"action": "destroy"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# DELETE /api/devices/557828ff766f6c33e49d0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"fromat"=>"json", "id"=>"557828ff766f6c33e49d0000", "controller"=>"api/devices", "action"=>"destroy"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
|
@ -77,12 +73,40 @@
|
|||
```
|
||||
|
||||
|
||||
# POST /api/schedules
|
||||
# PUT /api/devices/557829b5766f6c350d800000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"sequence_id"=>"557828fa766f6c33e40a0000", "start_time"=>"2015-02-17T15:16:17.000Z", "end_time"=>"2099-02-17T18:19:20.000Z", "repeat"=>"4", "time_unit"=>"minutely", "controller"=>"api/schedules", "action"=>"create"}
|
||||
{
|
||||
"name": "Dr. Amina Rau",
|
||||
"id": "557829b5766f6c350d800000",
|
||||
"controller": "api/devices",
|
||||
"action": "update"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557829b5766f6c350d800000",
|
||||
"name": "Dr. Amina Rau",
|
||||
"uuid": "7b1ebadd-aa1f-4e07-9829-f81f7ebc5108",
|
||||
"token": "qj5UVWLDFa4m_WbNi6f61g"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# GET /api/schedules
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"controller": "api/schedules",
|
||||
"action": "index"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -98,7 +122,10 @@ Too big to display.
|
|||
### Request
|
||||
|
||||
```
|
||||
{"controller"=>"api/schedules", "action"=>"index"}
|
||||
{
|
||||
"controller": "api/schedules",
|
||||
"action": "index"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -111,13 +138,20 @@ Too big to display.
|
|||
|
||||
|
||||
|
||||
|
||||
# GET /api/schedules
|
||||
# POST /api/schedules
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"controller"=>"api/schedules", "action"=>"index"}
|
||||
{
|
||||
"sequence_id": "557829b5766f6c350d980000",
|
||||
"start_time": "2015-02-17T15:16:17.000Z",
|
||||
"end_time": "2099-02-17T18:19:20.000Z",
|
||||
"repeat": "4",
|
||||
"time_unit": "minutely",
|
||||
"controller": "api/schedules",
|
||||
"action": "create"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -127,12 +161,52 @@ Too big to display.
|
|||
```
|
||||
|
||||
|
||||
# DELETE /api/schedules/557828fb766f6c33e4210000
|
||||
|
||||
# PATCH /api/schedules/557829b5766f6c350d6f0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"id"=>"557828fb766f6c33e4210000", "controller"=>"api/schedules", "action"=>"destroy"}
|
||||
{
|
||||
"schedule": {
|
||||
"repeat": "66"
|
||||
},
|
||||
"id": "557829b5766f6c350d6f0000",
|
||||
"controller": "api/schedules",
|
||||
"action": "update"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557829b5766f6c350d6f0000",
|
||||
"start_time": "2015-06-09T05:01:00.000Z",
|
||||
"end_time": "2015-06-12T00:01:00.000Z",
|
||||
"next_time": "2015-06-11T05:01:00.000Z",
|
||||
"repeat": 66,
|
||||
"time_unit": "daily",
|
||||
"sequence_id": "557829b5766f6c350d720000",
|
||||
"sequence_name": "Reactive systemic project",
|
||||
"calendar": [
|
||||
"2015-06-09T05:01:00.000Z"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
# DELETE /api/schedules/557829b6766f6c350dad0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"id": "557829b6766f6c350dad0000",
|
||||
"controller": "api/schedules",
|
||||
"action": "destroy"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -143,29 +217,38 @@ Too big to display.
|
|||
|
||||
|
||||
|
||||
# PATCH /api/schedules/557828ff766f6c33e4900000
|
||||
# POST /api/sequences
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"schedule"=>{"repeat"=>"66"}, "id"=>"557828ff766f6c33e4900000", "controller"=>"api/schedules", "action"=>"update"}
|
||||
{
|
||||
"name": "Scare Birds",
|
||||
"steps": [
|
||||
{
|
||||
"message_type": "move_relative",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": "1",
|
||||
"y": "2",
|
||||
"z": "3",
|
||||
"speed": "100",
|
||||
"delay": "0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"controller": "api/sequences",
|
||||
"action": "create"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828ff766f6c33e4900000",
|
||||
"start_time": "2015-06-09T05:01:00.000Z",
|
||||
"end_time": "2015-06-12T00:01:00.000Z",
|
||||
"next_time": "2015-06-11T05:01:00.000Z",
|
||||
"repeat": 66,
|
||||
"time_unit": "daily",
|
||||
"sequence_id": "557828ff766f6c33e4930000",
|
||||
"sequence_name": "Fully-configurable methodical hardware",
|
||||
"calendar": [
|
||||
"2015-06-09T05:01:00.000Z"
|
||||
]
|
||||
"_id": "557829b2766f6c350d250000",
|
||||
"name": "Scare Birds",
|
||||
"color": "purple"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -176,7 +259,10 @@ Too big to display.
|
|||
### Request
|
||||
|
||||
```
|
||||
{"controller"=>"api/sequences", "action"=>"index"}
|
||||
{
|
||||
"controller": "api/sequences",
|
||||
"action": "index"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
@ -184,190 +270,37 @@ Too big to display.
|
|||
```
|
||||
[
|
||||
{
|
||||
"_id": "557828fb766f6c33e43c0000",
|
||||
"name": "Decentralized content-based hub",
|
||||
"color": "gray"
|
||||
},
|
||||
{
|
||||
"_id": "557828fb766f6c33e43e0000",
|
||||
"name": "Innovative zero tolerance superstructure",
|
||||
"_id": "557829b2766f6c350d640000",
|
||||
"name": "Multi-tiered responsive strategy",
|
||||
"color": "pink"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
# POST /api/sequences
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"name"=>"Scare Birds", "steps"=>[{"message_type"=>"move_relative", "command"=>{"action"=>"MOVE RELATIVE", "x"=>"1", "y"=>"2", "z"=>"3", "speed"=>"100", "delay"=>"0"}}], "controller"=>"api/sequences", "action"=>"create"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828fc766f6c33e46e0000",
|
||||
"name": "Scare Birds",
|
||||
"color": "yellow"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
# POST /api/sequences/557828fb766f6c33e42f0000/steps
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"name"=>"Scare Birds", "message_type"=>"move_relative", "command"=>{"action"=>"MOVE RELATIVE", "x"=>"1", "y"=>"2", "z"=>"3", "speed"=>"100", "delay"=>"0"}, "sequence_id"=>"557828fb766f6c33e42f0000", "controller"=>"api/steps", "action"=>"create"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828fb766f6c33e4310000",
|
||||
"message_type": "move_relative",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": "1",
|
||||
"y": "2",
|
||||
"z": "3",
|
||||
"speed": "100",
|
||||
"delay": "0"
|
||||
},
|
||||
"sequence_id": "557828fb766f6c33e42f0000",
|
||||
"position": 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# DELETE /api/sequences/557828fc766f6c33e4590000/steps/557828fc766f6c33e45a0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"sequence_id"=>"557828fc766f6c33e4590000", "id"=>"557828fc766f6c33e45a0000", "controller"=>"api/steps", "action"=>"destroy"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
# GET /api/sequences/557828fc766f6c33e46a0000/steps
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"sequence_id"=>"557828fc766f6c33e46a0000", "controller"=>"api/steps", "action"=>"index"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
[
|
||||
{
|
||||
"_id": "557828fc766f6c33e46b0000",
|
||||
"message_type": "single_command",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"z": 3,
|
||||
"speed": 100,
|
||||
"delay": 0
|
||||
},
|
||||
"sequence_id": "557828fc766f6c33e46a0000",
|
||||
"position": 1
|
||||
"_id": "557829b2766f6c350d660000",
|
||||
"name": "Reduced asymmetric budgetary management",
|
||||
"color": "purple"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
# PATCH /api/sequences/557828fc766f6c33e4740000/steps/557828fc766f6c33e4750000
|
||||
# GET /api/sequences/557829b1766f6c350d060000/steps/557829b1766f6c350d070000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"step"=>{"message_type"=>"read_status"}, "id"=>"557828fc766f6c33e4750000", "sequence_id"=>"557828fc766f6c33e4740000", "controller"=>"api/steps", "action"=>"update"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828fc766f6c33e4750000",
|
||||
"message_type": "read_status",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"z": 3,
|
||||
"speed": 100,
|
||||
"delay": 0
|
||||
},
|
||||
"sequence_id": "557828fc766f6c33e4740000",
|
||||
"position": 1
|
||||
"sequence_id": "557829b1766f6c350d060000",
|
||||
"id": "557829b1766f6c350d070000",
|
||||
"controller": "api/steps",
|
||||
"action": "show"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# DELETE /api/sequences/557828fe766f6c33e4840000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"id"=>"557828fe766f6c33e4840000", "controller"=>"api/sequences", "action"=>"destroy"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
# PATCH /api/sequences/557828ff766f6c33e4ae0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"sequence"=>{"name"=>"Scare Birds", "steps"=>[{"message_type"=>"move_relative", "command"=>{"action"=>"MOVE RELATIVE", "x"=>"1", "y"=>"2", "z"=>"3", "speed"=>"100", "delay"=>"0"}}]}, "id"=>"557828ff766f6c33e4ae0000", "controller"=>"api/sequences", "action"=>"update"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828ff766f6c33e4ae0000",
|
||||
"name": "Scare Birds",
|
||||
"color": "yellow"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# GET /api/sequences/557828ff766f6c33e4b20000/steps/557828ff766f6c33e4b30000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"sequence_id"=>"557828ff766f6c33e4b20000", "id"=>"557828ff766f6c33e4b30000", "controller"=>"api/steps", "action"=>"show"}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828ff766f6c33e4b30000",
|
||||
"_id": "557829b1766f6c350d070000",
|
||||
"message_type": "single_command",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
|
@ -377,27 +310,224 @@ Too big to display.
|
|||
"speed": 100,
|
||||
"delay": 0
|
||||
},
|
||||
"sequence_id": "557828ff766f6c33e4b20000",
|
||||
"sequence_id": "557829b1766f6c350d060000",
|
||||
"position": 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# GET /api/sequences/557828ff766f6c33e4b60000
|
||||
# GET /api/sequences/557829b2766f6c350d120000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{"id"=>"557828ff766f6c33e4b60000", "controller"=>"api/sequences", "action"=>"show"}
|
||||
{
|
||||
"id": "557829b2766f6c350d120000",
|
||||
"controller": "api/sequences",
|
||||
"action": "show"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557828ff766f6c33e4b60000",
|
||||
"name": "Secured exuding knowledge base",
|
||||
"color": "pink"
|
||||
"_id": "557829b2766f6c350d120000",
|
||||
"name": "Advanced neutral frame",
|
||||
"color": "blue"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# GET /api/sequences/557829b2766f6c350d370000/steps
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"sequence_id": "557829b2766f6c350d370000",
|
||||
"controller": "api/steps",
|
||||
"action": "index"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
[
|
||||
{
|
||||
"_id": "557829b2766f6c350d380000",
|
||||
"message_type": "single_command",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"z": 3,
|
||||
"speed": 100,
|
||||
"delay": 0
|
||||
},
|
||||
"sequence_id": "557829b2766f6c350d370000",
|
||||
"position": 1
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
# DELETE /api/sequences/557829b2766f6c350d400000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"id": "557829b2766f6c350d400000",
|
||||
"controller": "api/sequences",
|
||||
"action": "destroy"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
# DELETE /api/sequences/557829b2766f6c350d510000/steps/557829b2766f6c350d520000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"sequence_id": "557829b2766f6c350d510000",
|
||||
"id": "557829b2766f6c350d520000",
|
||||
"controller": "api/steps",
|
||||
"action": "destroy"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
# PATCH /api/sequences/557829b2766f6c350d600000/steps/557829b2766f6c350d610000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"step": {
|
||||
"message_type": "read_status"
|
||||
},
|
||||
"id": "557829b2766f6c350d610000",
|
||||
"sequence_id": "557829b2766f6c350d600000",
|
||||
"controller": "api/steps",
|
||||
"action": "update"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557829b2766f6c350d610000",
|
||||
"message_type": "read_status",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"z": 3,
|
||||
"speed": 100,
|
||||
"delay": 0
|
||||
},
|
||||
"sequence_id": "557829b2766f6c350d600000",
|
||||
"position": 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# POST /api/sequences/557829b5766f6c350d910000/steps
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"name": "Scare Birds",
|
||||
"message_type": "move_relative",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": "1",
|
||||
"y": "2",
|
||||
"z": "3",
|
||||
"speed": "100",
|
||||
"delay": "0"
|
||||
},
|
||||
"sequence_id": "557829b5766f6c350d910000",
|
||||
"controller": "api/steps",
|
||||
"action": "create"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557829b5766f6c350d930000",
|
||||
"message_type": "move_relative",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": "1",
|
||||
"y": "2",
|
||||
"z": "3",
|
||||
"speed": "100",
|
||||
"delay": "0"
|
||||
},
|
||||
"sequence_id": "557829b5766f6c350d910000",
|
||||
"position": 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# PATCH /api/sequences/557829b6766f6c350d9f0000
|
||||
|
||||
### Request
|
||||
|
||||
```
|
||||
{
|
||||
"sequence": {
|
||||
"name": "Scare Birds",
|
||||
"steps": [
|
||||
{
|
||||
"message_type": "move_relative",
|
||||
"command": {
|
||||
"action": "MOVE RELATIVE",
|
||||
"x": "1",
|
||||
"y": "2",
|
||||
"z": "3",
|
||||
"speed": "100",
|
||||
"delay": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "557829b6766f6c350d9f0000",
|
||||
"controller": "api/sequences",
|
||||
"action": "update"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```
|
||||
{
|
||||
"_id": "557829b6766f6c350d9f0000",
|
||||
"name": "Scare Birds",
|
||||
"color": "orange"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
### Request
|
||||
|
||||
```
|
||||
<%= request.params %>
|
||||
<%= JSON.pretty_generate(request.params) %>
|
||||
```
|
||||
|
||||
### Response
|
||||
|
|
Loading…
Reference in New Issue