Asset Relationship API

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.

Asset Relationship Save

PUT /v1/relationship

Create or update an Asset Relationship.

Query Parameters:
 
  • asset (string) – Optional. If this and ‘type’ are specified, then this will overwrite matching Relationships.
  • related (string) – Optional. If this and ‘type’ are specified, then this will overwrite matching Relationships.
  • type (string) – Optional. Must appear with ‘related’ or ‘asset’. The type of Relationship to override.
Request Headers:
 
Status Codes:

http

PUT /v1/relationship HTTP/1.1
Host: localhost:5635
Content-Type: application/json

{
  "assetId": "asset123",
  "relationshipType": "scene",
  "relatedId": "scene123"
}

curl

curl -i -X PUT http://localhost:5635/v1/relationship -H 'Content-Type: application/json' --data-raw '{"assetId": "asset123", "relatedId": "scene123", "relationshipType": "scene"}'

wget

wget -S -O- --method=PUT http://localhost:5635/v1/relationship --header='Content-Type: application/json' --body-data='{"assetId": "asset123", "relatedId": "scene123", "relationshipType": "scene"}'

httpie

echo '{
  "assetId": "asset123",
  "relatedId": "scene123",
  "relationshipType": "scene"
}' | http PUT http://localhost:5635/v1/relationship Content-Type:application/json

python-requests

requests.put('http://localhost:5635/v1/relationship', headers={'Content-Type': 'application/json'}, json={'assetId': 'asset123', 'relatedId': 'scene123', 'relationshipType': 'scene'})

response

HTTP/1.1 200 OK
Location: http://localhost:5635/v1/relationship

[
    {
        "id": "5bbec73700bd755e5e2e9630",
        "assetId": "5bbd6ea100bd75575fb32ca8",
        "relationshipType": "scene",
        "relatedId": "123"
    }
]

Asset Relationship Deletion

DELETE /v1/relationship

Delete an Asset Relationship.

Query Parameters:
 
  • asset (string) – Required. The Asset ID of the Relationship to delete.
  • related (string) – Required. The Related ID of the Relationship to delete.
  • type (string) – Required. The type of Relationship to delete.
Status Codes:

http

DELETE /v1/relationship?type=scene&related=123&asset=456 HTTP/1.1
Host: localhost:5635

curl

curl -i -X DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'

wget

wget -S -O- --method=DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'

httpie

http DELETE 'http://localhost:5635/v1/relationship?type=scene&related=123&asset=456'

python-requests

requests.delete('http://localhost:5635/v1/relationship?type=scene&related=123&asset=456')

Asset Relationship Query

GET /v1/relationship

Find Asset Relationships based on one or more attributes.

Query Parameters:
 
  • asset (string) – Optional. The Asset ID of the Relationship to find.
  • related (string) – Optional. The Related ID of the Relationship to find.
  • type (string) – Optional. The type of Relationship to find.
Status Codes:

http

GET /v1/relationship?type=scene&related=123 HTTP/1.1
Host: localhost:5635

curl

curl -i 'http://localhost:5635/v1/relationship?type=scene&related=123'

wget

wget -S -O- 'http://localhost:5635/v1/relationship?type=scene&related=123'

httpie

http 'http://localhost:5635/v1/relationship?type=scene&related=123'

python-requests

requests.get('http://localhost:5635/v1/relationship?type=scene&related=123')

response

HTTP/1.1 200 OK
Location: http://localhost:5635/v1/relationship?type=scene&related=123

[
    {
        "id": "5bbd6ea100bd75575fb32caa",
        "assetId": "5bbd6ea100bd75575fb32ca8",
        "relationshipType": "thumbnail",
        "relatedId": "5bbd6da600bd75575fb32ca5"
    }
]