An Asset Relationship is a link between an asset and any other data entity which is identifiable by a unique ID. Each relationship contains an Asset ID and a Related ID, as well as a Relationship Type. These can be used to model relationships with both external sources (such as a Renderable Object in a video game), or to model relationships between assets (such as having one Asset be the thumbnail of another).
By storing these relationships within Kelona, any updated Asset is immediately associated to any other data sources. Any user loading that related object must query Kelona to retrieve the necessary Assets, which they do by querying this API.
PUT
/v1/relationship
¶Create or update an Asset Relationship.
Query Parameters: | |
---|---|
|
|
Request Headers: | |
|
|
Status Codes: |
|
PUT /v1/relationship HTTP/1.1
Host: localhost:5635
Content-Type: application/json
{
"assetId": "asset123",
"relationshipType": "scene",
"relatedId": "scene123"
}
curl -i -X PUT http://localhost:5635/v1/relationship -H 'Content-Type: application/json' --data-raw '{"assetId": "asset123", "relatedId": "scene123", "relationshipType": "scene"}'
wget -S -O- --method=PUT http://localhost:5635/v1/relationship --header='Content-Type: application/json' --body-data='{"assetId": "asset123", "relatedId": "scene123", "relationshipType": "scene"}'
echo '{
"assetId": "asset123",
"relatedId": "scene123",
"relationshipType": "scene"
}' | http PUT http://localhost:5635/v1/relationship Content-Type:application/json
requests.put('http://localhost:5635/v1/relationship', headers={'Content-Type': 'application/json'}, json={'assetId': 'asset123', 'relatedId': 'scene123', 'relationshipType': 'scene'})
HTTP/1.1 200 OK
Location: http://localhost:5635/v1/relationship
[
{
"id": "5bbec73700bd755e5e2e9630",
"assetId": "5bbd6ea100bd75575fb32ca8",
"relationshipType": "scene",
"relatedId": "123"
}
]
DELETE
/v1/relationship
¶Delete an Asset Relationship.
Query Parameters: | |
---|---|
|
|
Status Codes: |
|
DELETE /v1/relationship?type=scene&related=123&asset=456 HTTP/1.1
Host: localhost:5635
curl -i -X DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'
wget -S -O- --method=DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'
http DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'
requests.delete('http://localhost:5635/v1/relationship?type=scene&related=123&asset=456')
GET
/v1/relationship
¶Find Asset Relationships based on one or more attributes.
Query Parameters: | |
---|---|
|
|
Status Codes: |
|
GET /v1/relationship?type=scene&related=123 HTTP/1.1
Host: localhost:5635
curl -i 'http://localhost:5635/v1/relationship?type=scene&related=123'
wget -S -O- 'http://localhost:5635/v1/relationship?type=scene&related=123'
http 'http://localhost:5635/v1/relationship?type=scene&related=123'
requests.get('http://localhost:5635/v1/relationship?type=scene&related=123')
HTTP/1.1 200 OK
Location: http://localhost:5635/v1/relationship?type=scene&related=123
[
{
"id": "5bbd6ea100bd75575fb32caa",
"assetId": "5bbd6ea100bd75575fb32ca8",
"relationshipType": "thumbnail",
"relatedId": "5bbd6da600bd75575fb32ca5"
}
]