Scene Registration API

Devices need to register/de-register to scenes as they move around in the world, and Aesel uses this information to determine what object updates to stream out to that device. This API allows for registration, de-registration, and synchronization of devices to scenes.

Scene Registration

POST /v1/register

Devices are expected to register to scenes as they move through space. This tells Aesel what objects that device needs to receive information on. If the specified scene is not present, then it will be created. The response will contain the transform to the desired scene, as well as the ID of the scene the transform is coming from.

Request Headers:
 
Status Codes:

http

POST /v1/register HTTP/1.1
Host: localhost:5885
Content-Type: application/json

{
  "scenes":[
    {
      "key":"jklmnop",
      "devices":[
        {
          "key":"Ud132",
          "hostname": "localhost",
                            "port":4444,
                            "connection_string": "127.0.0.1:4444",
          "transform":{
            "translation":[0,0,0],
            "rotation":[0,0,0]
          }
        }
      ]
    }
  ]
}

curl

curl -i -X POST http://localhost:5885/v1/register -H 'Content-Type: application/json' --data-raw '{"scenes": [{"devices": [{"connection_string": "127.0.0.1:4444", "hostname": "localhost", "port": 4444, "key": "Ud132", "transform": {"translation": [0, 0, 0], "rotation": [0, 0, 0]}}], "key": "jklmnop"}]}'

wget

wget -S -O- http://localhost:5885/v1/register --header='Content-Type: application/json' --post-data='{"scenes": [{"devices": [{"connection_string": "127.0.0.1:4444", "hostname": "localhost", "port": 4444, "key": "Ud132", "transform": {"translation": [0, 0, 0], "rotation": [0, 0, 0]}}], "key": "jklmnop"}]}'

httpie

echo '{
  "scenes": [
    {
      "devices": [
        {
          "connection_string": "127.0.0.1:4444",
          "hostname": "localhost",
          "key": "Ud132",
          "port": 4444,
          "transform": {
            "rotation": [
              0,
              0,
              0
            ],
            "translation": [
              0,
              0,
              0
            ]
          }
        }
      ],
      "key": "jklmnop"
    }
  ]
}' | http POST http://localhost:5885/v1/register Content-Type:application/json

python-requests

requests.post('http://localhost:5885/v1/register', headers={'Content-Type': 'application/json'}, json={'scenes': [{'devices': [{'connection_string': '127.0.0.1:4444', 'hostname': 'localhost', 'port': 4444, 'key': 'Ud132', 'transform': {'translation': [0, 0, 0], 'rotation': [0, 0, 0]}}], 'key': 'jklmnop'}]})

response

HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene/name/register
Content-Type: application/json

{
    "msg_type": 4,
    "err_code": 100,
    "num_records": 2,
    "scenes": [
        {
            "key": "20dd78a2-9224-11e8-b492-d850e6db3ad1",
            "active": true,
            "distance": 0,
            "assets": [],
            "tags": [],
            "devices": [
                {
                    "key": "12345",
                    "transform": {
                        "translation": [
                            0,
                            0,
                            0
                        ],
                        "rotation": [
                            0,
                            0,
                            0
                        ]
                    }
                }
            ]
        },
        {
            "key": "123456",
            "active": true,
            "distance": 0,
            "assets": [],
            "tags": [],
            "devices": []
        }
    ]
}

Scene De-Registration

POST /v1/deregister

Devices are expected to register to scenes as they move through space. This tells Aesel what objects that device needs to receive information on. De-Registration occurs after a device has left the scene and joined others, and is now ready to stop receiving updates on objects within the old scene.

Note that devices are expected to de-register only after registering with a new scene and performing any necessary corrections. This allows a network of transformations to be created, which can be used to pre-calculate those needed for future registrations.

Request Headers:
 
Status Codes:

http

POST /v1/deregister HTTP/1.1
Host: localhost:5885
Content-Type: application/json

{
  "scenes":[
    {
      "key":"jklmnop",
      "devices":[
        {
          "key":"Ud132"
        }
      ]
    }
  ]
}

curl

curl -i -X POST http://localhost:5885/v1/deregister -H 'Content-Type: application/json' --data-raw '{"scenes": [{"devices": [{"key": "Ud132"}], "key": "jklmnop"}]}'

wget

wget -S -O- http://localhost:5885/v1/deregister --header='Content-Type: application/json' --post-data='{"scenes": [{"devices": [{"key": "Ud132"}], "key": "jklmnop"}]}'

httpie

echo '{
  "scenes": [
    {
      "devices": [
        {
          "key": "Ud132"
        }
      ],
      "key": "jklmnop"
    }
  ]
}' | http POST http://localhost:5885/v1/deregister Content-Type:application/json

python-requests

requests.post('http://localhost:5885/v1/deregister', headers={'Content-Type': 'application/json'}, json={'scenes': [{'devices': [{'key': 'Ud132'}], 'key': 'jklmnop'}]})

Scene Synchronization

POST /v1/align

Aesel will not always be able to supply a device with an accurate transformation upon registering to a scene. In particular, this will happen when the device first registers to a scene with no prior registrations, as well as when the network of transformations is first being built and collected. In these cases, the Device will need to supply Aesel with a correction in order to correct the transformation.

Request Headers:
 
Status Codes:

http

POST /v1/align HTTP/1.1
Host: localhost:5885
Content-Type: application/json

{
  "scenes":[
    {
      "key":"jklmnop",
      "devices":[
        {
          "key":"Ud132",
          "transform":{
            "translation":[0,0,0],
            "rotation":[0,0,0]
          }
        }
      ]
    }
  ]
}

curl

curl -i -X POST http://localhost:5885/v1/align -H 'Content-Type: application/json' --data-raw '{"scenes": [{"devices": [{"transform": {"translation": [0, 0, 0], "rotation": [0, 0, 0]}, "key": "Ud132"}], "key": "jklmnop"}]}'

wget

wget -S -O- http://localhost:5885/v1/align --header='Content-Type: application/json' --post-data='{"scenes": [{"devices": [{"transform": {"translation": [0, 0, 0], "rotation": [0, 0, 0]}, "key": "Ud132"}], "key": "jklmnop"}]}'

httpie

echo '{
  "scenes": [
    {
      "devices": [
        {
          "key": "Ud132",
          "transform": {
            "rotation": [
              0,
              0,
              0
            ],
            "translation": [
              0,
              0,
              0
            ]
          }
        }
      ],
      "key": "jklmnop"
    }
  ]
}' | http POST http://localhost:5885/v1/align Content-Type:application/json

python-requests

requests.post('http://localhost:5885/v1/align', headers={'Content-Type': 'application/json'}, json={'scenes': [{'devices': [{'transform': {'translation': [0, 0, 0], 'rotation': [0, 0, 0]}, 'key': 'Ud132'}], 'key': 'jklmnop'}]})