A Scene is a group of Objects associated to a particular Latitude and Longitude. This API exposes CRUD and Query operations for Scenes.
POST /v1/scene/¶Create a new scene. A new key will be generated and returned in the response.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/scene HTTP/1.1
Host: localhost:5885
Content-Type: application/json
{
"scenes": [
{
"name": "testScene",
"region":"US-MD",
"latitude":124,
"longitude":122,
"assets":["TestAsset10"],
"tags":["Testing2"]
}
]
}
curl
curl -i -X POST http://localhost:5885/v1/scene -H 'Content-Type: application/json' --data-raw '{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
wget
wget -S -O- http://localhost:5885/v1/scene --header='Content-Type: application/json' --post-data='{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
httpie
echo '{
"scenes": [
{
"assets": [
"TestAsset10"
],
"latitude": 124,
"longitude": 122,
"name": "testScene",
"region": "US-MD",
"tags": [
"Testing2"
]
}
]
}' | http POST http://localhost:5885/v1/scene Content-Type:application/json
python-requests
requests.post('http://localhost:5885/v1/scene', headers={'Content-Type': 'application/json'}, json={'scenes': [{'name': 'testScene', 'tags': ['Testing2'], 'region': 'US-MD', 'longitude': 122, 'latitude': 124, 'assets': ['TestAsset10']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene
Content-Type: application/json
{
"num_records":1,
"scenes":[{"key":"jklmnop"}]
}
PUT /v1/scene/(key)¶Create a new scene. The provided key will be assigned to the scene.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/scene/jklmnop HTTP/1.1
Host: localhost:5885
Content-Type: application/json
{
"scenes": [
{
"name": "testScene",
"region":"US-MD",
"latitude":124,
"longitude":122,
"assets":["TestAsset10"],
"tags":["Testing2"]
}
]
}
curl
curl -i -X POST http://localhost:5885/v1/scene/jklmnop -H 'Content-Type: application/json' --data-raw '{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
wget
wget -S -O- http://localhost:5885/v1/scene/jklmnop --header='Content-Type: application/json' --post-data='{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
httpie
echo '{
"scenes": [
{
"assets": [
"TestAsset10"
],
"latitude": 124,
"longitude": 122,
"name": "testScene",
"region": "US-MD",
"tags": [
"Testing2"
]
}
]
}' | http POST http://localhost:5885/v1/scene/jklmnop Content-Type:application/json
python-requests
requests.post('http://localhost:5885/v1/scene/jklmnop', headers={'Content-Type': 'application/json'}, json={'scenes': [{'name': 'testScene', 'tags': ['Testing2'], 'region': 'US-MD', 'longitude': 122, 'latitude': 124, 'assets': ['TestAsset10']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene
Content-Type: application/json
{
"num_records":1,
"scenes":[{"key":"jklmnop"}]
}
http
GET /v1/scene HTTP/1.1
Host: localhost:5885
curl
curl -i http://localhost:5885/v1/scene
wget
wget -S -O- http://localhost:5885/v1/scene
httpie
http http://localhost:5885/v1/scene
python-requests
requests.get('http://localhost:5885/v1/scene')
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene
Content-Type: application/json
{
"msg_type": 2,
"err_code": 100,
"num_records": 1,
"start_record": 0,
"scenes": [
{
"key": "855ca840-c864-11e8-9a4a-309c23d74017",
"name": "testScene",
"region": "us-ga",
"latitude": 100,
"active": true,
"longitude": 100,
"distance": 0,
"assets": [
"asset1"
],
"tags": [
"tag1"
],
"devices": []
}
]
}
POST /v1/scene/(key)¶Update an existing Scene with the specified key.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/scene/name HTTP/1.1
Host: localhost:5885
Content-Type: application/json
{
"scenes": [
{
"name": "testScene",
"region":"US-MD",
"latitude":124,
"longitude":122,
"assets":["TestAsset10"],
"tags":["Testing2"]
}
]
}
curl
curl -i -X POST http://localhost:5885/v1/scene/name -H 'Content-Type: application/json' --data-raw '{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
wget
wget -S -O- http://localhost:5885/v1/scene/name --header='Content-Type: application/json' --post-data='{"scenes": [{"name": "testScene", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
httpie
echo '{
"scenes": [
{
"assets": [
"TestAsset10"
],
"latitude": 124,
"longitude": 122,
"name": "testScene",
"region": "US-MD",
"tags": [
"Testing2"
]
}
]
}' | http POST http://localhost:5885/v1/scene/name Content-Type:application/json
python-requests
requests.post('http://localhost:5885/v1/scene/name', headers={'Content-Type': 'application/json'}, json={'scenes': [{'name': 'testScene', 'tags': ['Testing2'], 'region': 'US-MD', 'longitude': 122, 'latitude': 124, 'assets': ['TestAsset10']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene
Content-Type: application/json
{
"num_records":1,
"scenes":[{"key":"jklmnop"}]
}
DELETE /v1/scene/(key)¶Delete a scene.
CAUTION: This will delete all information associated to a scene, including all objects in the scene, and any registrations to devices. Any object which needs to be retained should be moved to another scene prior to deletion.
| Status Codes: |
|
|---|
http
DELETE /v1/scene/name HTTP/1.1
Host: localhost:5885
curl
curl -i -X DELETE http://localhost:5885/v1/scene/name
wget
wget -S -O- --method=DELETE http://localhost:5885/v1/scene/name
httpie
http DELETE http://localhost:5885/v1/scene/name
python-requests
requests.delete('http://localhost:5885/v1/scene/name')
POST /v1/scene/query¶Devices can find scenes by any attribute, including distance.
The fields ‘latitude’, ‘longitude’, and ‘distance’ should always appear together if present. The distance provided is taken in kilometers.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/scene/query HTTP/1.1
Host: localhost:5885
Content-Type: application/json
{
"scenes":[
{
"name":"test",
"region":"US-MD",
"latitude":124,
"longitude":122,
"assets":["TestAsset10"],
"tags":["Testing2"]
}
]
}
curl
curl -i -X POST http://localhost:5885/v1/scene/query -H 'Content-Type: application/json' --data-raw '{"scenes": [{"name": "test", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
wget
wget -S -O- http://localhost:5885/v1/scene/query --header='Content-Type: application/json' --post-data='{"scenes": [{"name": "test", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'
httpie
echo '{
"scenes": [
{
"assets": [
"TestAsset10"
],
"latitude": 124,
"longitude": 122,
"name": "test",
"region": "US-MD",
"tags": [
"Testing2"
]
}
]
}' | http POST http://localhost:5885/v1/scene/query Content-Type:application/json
python-requests
requests.post('http://localhost:5885/v1/scene/query', headers={'Content-Type': 'application/json'}, json={'scenes': [{'name': 'test', 'tags': ['Testing2'], 'region': 'US-MD', 'longitude': 122, 'latitude': 124, 'assets': ['TestAsset10']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene/query
Content-Type: application/json
{
"num_records":1,
"scenes":[
{
"key":"jklmnop",
"name":"TestScene10",
"region":"US-MD",
"latitude":124.0,
"longitude":122.0,
"tags":["test","test2"],
"asset_ids":["asset1","asset2"]
}
]
}