An Object is represented by a transformation matrix representing it’s position in 3-space, as well as a collection of Assets (Mesh files, Texture files, Shader scripts, etc.), and potentially a frame and/or timestamp. This API exposes CRUD and Query operations for Objects.
Objects are meant to be interacted with by individual devices, and these changes will be streamed to other devices via the Events API. In addition, Create and Update messages sent to the HTTP API are converted to events and streamed out to registered devices.
POST /v1/object/¶Create a new object.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/object HTTP/1.1
Host: localhost:8768
Content-Type: application/json
{
"msg_type": 0,
"objects":[
{
"name": "Test Object 123464",
"type": "Curve",
"subtype": "Sphere",
"owner": "",
"frame": 0,
"timestamp": 123456789,
"translation": [0, 0, 1],
"quaternion_rotation": [0, 1, 0, 0],
"euler_rotation": [0, 0, 0],
"scale": [1, 1, 2],
"assets": ["Asset_5"],
"translation_handle":[
{"left_type":"test","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0}],
"rotation_handle":[
{"left_type":"test","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0}],
"scale_handle":[
{"left_type":"test","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0},
{"left_type":"","left_x":0,"left_y":0,"right_type":"","right_x":0,"right_y":0}]
}
]
}
curl
curl -i -X POST http://localhost:8768/v1/object -H 'Content-Type: application/json' --data-raw '{"msg_type": 0, "objects": [{"rotation_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "euler_rotation": [0, 0, 0], "scale": [1, 1, 2], "name": "Test Object 123464", "timestamp": 123456789, "frame": 0, "scale_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "subtype": "Sphere", "translation_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "quaternion_rotation": [0, 1, 0, 0], "owner": "", "translation": [0, 0, 1], "type": "Curve", "assets": ["Asset_5"]}]}'
wget
wget -S -O- http://localhost:8768/v1/object --header='Content-Type: application/json' --post-data='{"msg_type": 0, "objects": [{"rotation_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "euler_rotation": [0, 0, 0], "scale": [1, 1, 2], "name": "Test Object 123464", "timestamp": 123456789, "frame": 0, "scale_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "subtype": "Sphere", "translation_handle": [{"left_type": "test", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}, {"left_type": "", "left_x": 0, "left_y": 0, "right_x": 0, "right_y": 0, "right_type": ""}], "quaternion_rotation": [0, 1, 0, 0], "owner": "", "translation": [0, 0, 1], "type": "Curve", "assets": ["Asset_5"]}]}'
httpie
echo '{
"msg_type": 0,
"objects": [
{
"assets": [
"Asset_5"
],
"euler_rotation": [
0,
0,
0
],
"frame": 0,
"name": "Test Object 123464",
"owner": "",
"quaternion_rotation": [
0,
1,
0,
0
],
"rotation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"scale": [
1,
1,
2
],
"scale_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"subtype": "Sphere",
"timestamp": 123456789,
"translation": [
0,
0,
1
],
"translation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"type": "Curve"
}
]
}' | http POST http://localhost:8768/v1/object Content-Type:application/json
python-requests
requests.post('http://localhost:8768/v1/object', headers={'Content-Type': 'application/json'}, json={'msg_type': 0, 'objects': [{'rotation_handle': [{'left_type': 'test', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}], 'euler_rotation': [0, 0, 0], 'scale': [1, 1, 2], 'name': 'Test Object 123464', 'timestamp': 123456789, 'frame': 0, 'scale_handle': [{'left_type': 'test', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}], 'subtype': 'Sphere', 'translation_handle': [{'left_type': 'test', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}, {'left_type': '', 'left_x': 0, 'left_y': 0, 'right_x': 0, 'right_y': 0, 'right_type': ''}], 'quaternion_rotation': [0, 1, 0, 0], 'owner': '', 'translation': [0, 0, 1], 'type': 'Curve', 'assets': ['Asset_5']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:8768/v1/object
Content-Type: application/json
{
"num_records":1,
"objects":[{"key":"jklmnop"}]
}
POST /v1/object/{key}¶Update an existing object.
| Request Headers: | |
|---|---|
|
|
| Status Codes: |
|
http
POST /v1/object/{key} HTTP/1.1
Host: localhost:8768
Content-Type: application/json
{
"msg_type": 0,
"objects":[
{
"name": "Test Object 123464",
"type": "Curve",
"subtype": "Sphere",
"frame": 0
}
]
}
curl
curl -i -X POST 'http://localhost:8768/v1/object/{key}' -H 'Content-Type: application/json' --data-raw '{"msg_type": 0, "objects": [{"subtype": "Sphere", "frame": 0, "type": "Curve", "name": "Test Object 123464"}]}'
wget
wget -S -O- 'http://localhost:8768/v1/object/{key}' --header='Content-Type: application/json' --post-data='{"msg_type": 0, "objects": [{"subtype": "Sphere", "frame": 0, "type": "Curve", "name": "Test Object 123464"}]}'
httpie
echo '{
"msg_type": 0,
"objects": [
{
"frame": 0,
"name": "Test Object 123464",
"subtype": "Sphere",
"type": "Curve"
}
]
}' | http POST 'http://localhost:8768/v1/object/{key}' Content-Type:application/json
python-requests
requests.post('http://localhost:8768/v1/object/{key}', headers={'Content-Type': 'application/json'}, json={'msg_type': 0, 'objects': [{'subtype': 'Sphere', 'frame': 0, 'type': 'Curve', 'name': 'Test Object 123464'}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/object/{key}
Content-Type: application/json
{
"num_records":1,
"objects":[{"key":"jklmnop"}]
}
GET /v1/object/(key)¶Get an object details in JSON Format.
| Status Codes: |
|
|---|
http
GET /v1/object/{key} HTTP/1.1
Host: localhost:8768
curl
curl -i 'http://localhost:8768/v1/object/{key}'
wget
wget -S -O- 'http://localhost:8768/v1/object/{key}'
httpie
http 'http://localhost:8768/v1/object/{key}'
python-requests
requests.get('http://localhost:8768/v1/object/{key}')
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/object/{key}
Content-Type: application/json
{
"msg_type": 2,
"err_code": 100,
"num_records": 1,
"objects": [
{
"name": "Test Object 123464",
"type": "Curve",
"subtype": "Sphere",
"frame": 0,
"timestamp": 123456789,
"translation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"rotation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"scale_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"transform": [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2,
1,
0,
0,
0,
1
],
"assets": [
"Asset_5"
]
}
]
}
DELETE /v1/object/(key)¶Delete an object.
| Status Codes: |
|
|---|
http
DELETE /v1/object/{key} HTTP/1.1
Host: localhost:8768
curl
curl -i -X DELETE 'http://localhost:8768/v1/object/{key}'
wget
wget -S -O- --method=DELETE 'http://localhost:8768/v1/object/{key}'
httpie
http DELETE 'http://localhost:8768/v1/object/{key}'
python-requests
requests.delete('http://localhost:8768/v1/object/{key}')
GET /v1/object/query¶Query for objects which match the input JSON. This will only return as many records as specified in the field ‘num_records’.
| Status Codes: |
|
|---|
http
POST /v1/object/query HTTP/1.1
Host: localhost:5885
Content-Type: application/json
{
"objects":[
{
"name":"test",
"assets":["TestAsset10"]
}
]
}
curl
curl -i -X POST http://localhost:5885/v1/object/query -H 'Content-Type: application/json' --data-raw '{"objects": [{"name": "test", "assets": ["TestAsset10"]}]}'
wget
wget -S -O- http://localhost:5885/v1/object/query --header='Content-Type: application/json' --post-data='{"objects": [{"name": "test", "assets": ["TestAsset10"]}]}'
httpie
echo '{
"objects": [
{
"assets": [
"TestAsset10"
],
"name": "test"
}
]
}' | http POST http://localhost:5885/v1/object/query Content-Type:application/json
python-requests
requests.post('http://localhost:5885/v1/object/query', headers={'Content-Type': 'application/json'}, json={'objects': [{'name': 'test', 'assets': ['TestAsset10']}]})
response
HTTP/1.1 200 OK
Location: http://localhost:5885/v1/object/query
Content-Type: application/json
{
"msg_type": 2,
"err_code": 100,
"num_records": 1,
"objects": [
{
"name": "Test Object 123464",
"type": "Curve",
"subtype": "Sphere",
"frame": 0,
"timestamp": 123456789,
"translation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"rotation_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"scale_handle": [
{
"left_type": "test",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
},
{
"left_type": "",
"left_x": 0,
"left_y": 0,
"right_type": "",
"right_x": 0,
"right_y": 0
}
],
"transform": [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2,
1,
0,
0,
0,
1
],
"assets": [
"Asset_5"
]
}
]
}
GET /v1/object/{key}/lock¶A lock allows a single client to obtain ‘ownership’ of an object. This is an atomic operation, and is guaranteed to return a lock to one and only one client who requests it. Keep in mind, however, that no checks are performed within CLyman to verify that the object’s owner is the only one updating it, it is the responsibility of the client to obtain a lock prior to making updates.
| Status Codes: |
|
|---|---|
| Query Parameters: | |
|
|
http
GET /v1/object/{key}/lock?device=123 HTTP/1.1
Host: localhost:8768
curl
curl -i 'http://localhost:8768/v1/object/{key}/lock?device=123'
wget
wget -S -O- 'http://localhost:8768/v1/object/{key}/lock?device=123'
httpie
http 'http://localhost:8768/v1/object/{key}/lock?device=123'
python-requests
requests.get('http://localhost:8768/v1/object/{key}/lock?device=123')
DELETE /v1/object/{key}/lock¶Unlocking allows a client to release ‘ownership’ of an object. This is an atomic operation, and no additional locks will be granted on a locked object until this method is called by the owner.
| Status Codes: |
|
|---|---|
| Query Parameters: | |
|
|
http
DELETE /v1/object/{key}/lock?device=123 HTTP/1.1
Host: localhost:8768
curl
curl -i -X DELETE 'http://localhost:8768/v1/object/{key}/lock?device=123'
wget
wget -S -O- --method=DELETE 'http://localhost:8768/v1/object/{key}/lock?device=123'
httpie
http DELETE 'http://localhost:8768/v1/object/{key}/lock?device=123'
python-requests
requests.delete('http://localhost:8768/v1/object/{key}/lock?device=123')
PUT /v1/object/{object_key}/asset/{asset_key}¶We can add an asset to an object easily with this API, which requires no message body.
| Status Codes: |
|
|---|
http
PUT /v1/object/{object_key}/asset/{asset_key} HTTP/1.1
Host: localhost:8768
curl
curl -i -X PUT 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
wget
wget -S -O- --method=PUT 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
httpie
http PUT 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
python-requests
requests.put('http://localhost:8768/v1/object/{object_key}/asset/{asset_key}')
DELETE /v1/object/{object_key}/asset/{asset_key}¶We can remove an asset from an object easily with this API, which requires no message body.
| Status Codes: |
|
|---|
http
DELETE /v1/object/{object_key}/asset/{asset_key} HTTP/1.1
Host: localhost:8768
curl
curl -i -X DELETE 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
wget
wget -S -O- --method=DELETE 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
httpie
http DELETE 'http://localhost:8768/v1/object/{object_key}/asset/{asset_key}'
python-requests
requests.delete('http://localhost:8768/v1/object/{object_key}/asset/{asset_key}')