Asset Management - REST API

Overview

The API supports creating, getting, updating and deleting assets and asset relations. For every request, you will get a command id. To get the actual outcome of your issued command, you will need this command id to retrieve information from a kafka topic to know if it was successful or not.

Asset Management exposes its services via gRPC and REST. Finally, there is a Java interface based on asset-library Asset model. The current implementation uses the gRPC API, but it can be implemented using different transports in the future. It also exists a Dummy gRPC client that allows testing the gRPC API via a REST interface. It can also be used to test the Java interface.

Note
Although the API support bulk operations like getting or creating multiple assets at once, currently the implementation supports single asset operations (one asset at a time).

1. Asset

1.1. Get Asset

Allows getting information of one or more assets.

1.1.1. Example Request

POST /api/v1/get-assets HTTP/1.1
Content-Type: application/json
Content-Length: 56
Host: localhost:8080

{
    "asset_ids": [1000],
    "all_properties": false
}

Example Request Payload

Path Type Description
asset_ids[]

Array

Asset ids to be retrieved

all_properties

Boolean

If true will retrieve all properties related to this asset otherwise none or specified

1.1.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 64

{
  "assets": [{
    "asset_id": "1000",
    "version": 1
  }]
}

Example Response Payload

Path Type Description
assets[0].asset_id

String

Asset Id received

assets[0].version

Number

Asset version

1.1.3. Example Response when the asset doesn’t exist or is not visible to the user

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 18

{
  "assets": []
}

1.2. Get Asset with Properties

Allows getting information of one or more assets with properties.

1.2.1. Example Request

POST /api/v1/get-assets HTTP/1.1
Content-Type: application/json
Content-Length: 55
Host: localhost:8080

{
    "asset_ids": [1001],
    "all_properties": true
}

Example Request Payload

Path Type Description
asset_ids[]

Array

Asset ids to be retrieved

all_properties

Boolean

If true will retrieve all properties related to this asset otherwise none or specified

1.2.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 341

{
  "assets": [{
    "asset_id": "1001",
    "version": 1,
    "properties": [{
      "trait_name": "display",
      "property_name": "name",
      "values": [{
        "value": "Apple iPad 2 Vertical"
      }]
    }, {
      "trait_name": "ids",
      "property_name": "id",
      "values": [{
        "value": "1001"
      }]
    }]
  }]
}

Example Response Payload

Path Type Description
assets[0].asset_id

String

Asset Id received

assets[0].version

Number

Asset version

assets[0].properties[0].trait_name

String

Name of the asset trait property

assets[0].properties[0].property_name

String

Name of the asset property

assets[0].properties[0].values[]

Array

The properties values details

1.3. Create Asset

Allows creating new assets with preloaded properties.

1.3.1. Example Request

POST /api/v1/create-assets HTTP/1.1
Content-Type: application/json
Content-Length: 491
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "properties": [
        {
          "trait_name": "type",
          "property_name": "type",
          "values": [
            {
              "value": "text."
            }
          ]
        },
        {
          "trait_name": "display",
          "property_name": "name",
          "values": [
            {
              "value": "Demo asset"
            }
          ]
        }
      ]
    }
  ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 83

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "asset_ids": ["1000"]
}

1.3.2. Example Response

Path Type Description
command_id

String

The command id for this operation

requests[0].properties[0].trait_name

String

Name of the asset trait property

requests[0].properties[0].property_name

String

Name of the asset property

requests[0].properties[0].values[0].value

String

The properties values details

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

asset_ids[]

Array

Asset ids created

1.4. Update Asset

Allows updating asset properties.

1.4.1. Example Request

POST /api/v1/update-assets HTTP/1.1
Content-Type: application/json
Content-Length: 378
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_id": "16025",
      "properties": [
        {
          "operation": "UPDATE",
          "trait_name": "display",
          "property_name": "name",
          "values": [
            {
              "value": "Demo asset modified"
            }
          ]
        }
      ]
    }
  ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

1.4.2. Example Response

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[0].asset_id

String

Asset id to be updated

requests[0].properties[0].trait_name

String

Name of the asset trait property

requests[0].properties[0].property_name

String

Name of the asset property

requests[0].properties[0].operation

String

The operation to be executed

requests[0].properties[0].values[0].value

String

The value to be updated

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

1.5. Delete Asset

Allows removing assets.

1.5.1. Example Request

POST /api/v1/delete-assets HTTP/1.1
Content-Type: application/json
Content-Length: 117
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_id": "16025"
    }
  ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

1.5.2. Example Response

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[0].asset_id

String

Asset id to be deleted

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

2. Storage items

Overview

Explanation:

The storage items are just a few properties/fields such a the relative path, for example, and they come from a Hotfolder monitored by the FileService.

The calling logic has to ensure that the file is available to AM in a suitable folder. In this case that probably means that the file has to be copied (via FileService) to an asset-temp File System accessible to the legacy AM Locking the storage items file will happen in FileService

Important
The current implementation of AM does not have to know the details of file systems, it handles only URLs and (for the moment) it should not copy a file. This means that the storage item would just be part of the asset meta data that is passed to a createAsset call, it doesn’t need a separate parameter at all.

Current Scope

  • Get/Create/Update/Delete an asset with its storage items and the related information are coming in the meta data structure ( file properties )

Note
Please keep in mind that AM only forward properties information ( in this case particularly the file properties) and that’s it so any logic explanation mentioned on this article is actually happening on our legacy-bridge

Limitations

  • Due to our current asset-library limitation we only update storage items based on TYPE and MimeType

  • Additional indexes are missing and this is how it should work once we have it in place:

If we have an asset with 2 or more storage items and all of them are the same type and mimetype, and when we get an update request for one of them then we could in that case use an additional "index" information . This could be either of:

The element-index (Index/Key of the corresponding asset-element) (however, asset-elements are not (yet) reflected in the new asset-library model). The sequence index (0, 1, 2, …​) of the storage-item. (however, I think also sequence-indexes are not yet stored in the new asset-library model - but that has to be done.)

In the first iteration we assume that type/mimetype pairs are unique - which is actually true for most assets/storage-items. Exceptions to this rule are for example:

  • Previews

  • Thumbnails

  • InCopy assets with multiple stories

Updating a storage-item "in place", i.e. updating some of its attributes or even the URL (relPath), is a very uncommon scenario.

2.1. Create Asset with storage item

Allows creating new asset with preloaded properties and attache storage item to it.

2.1.1. Example Request

POST /api/v1/create-assets HTTP/1.1
Content-Type: application/json
Content-Length: 3130
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "properties": [
        {
          "trait_name": "type",
          "property_name": "type",
          "values": [
            {
              "value": "picture."
            }
          ]
        },
        {
          "trait_name": "display",
          "property_name": "name",
          "values": [
            {
              "value": "test asset"
            }
          ]
        },
        {
          "trait_name": "censhare_storage",
          "property_name": "storage",
          "values": [
            {
              "children": [
                {
                  "trait_name": "censhare_storage",
                  "property_name": "key",
                  "values": [
                    {
                      "value": "master"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "mimeType",
                  "values": [
                    {
                      "value": "image/jpeg"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "relPath",
                  "values": [
                    {
                      "value": "file:13/00/130000.jpg"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "state",
                  "values": [
                    {
                      "value": "0"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "fileLength",
                  "values": [
                    {
                      "value": "172927"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "widthPx",
                  "values": [
                    {
                      "value": "1596"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "heightPx",
                  "values": [
                    {
                      "value": "760"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "dpi",
                  "values": [
                    {
                      "value": "144"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "fileSystemName",
                  "values": [
                    {
                      "value": "assets"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 83

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "asset_ids": ["1000"]
}

2.1.2. Example Response

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[].properties[].trait_name

String

Name of the asset trait property

requests[].properties[].property_name

String

Name of the asset property

requests[].properties[].values[].value

String

The properties values details

requests[].properties[].values[].children[]

Array

The storage item property information

Example Response Payload

Path Type Description
asset_ids[]

Array

Asset relation ids created

command_id

String

Command id where kafka produced all related info to this action

2.2. Get Asset with storage item

Allows reading assets with storage items.

2.2.1. Example Request

POST /api/v1/get-assets HTTP/1.1
Content-Type: application/json
Content-Length: 192
Host: localhost:8080

{
    "asset_ids": [21191],
    "all_properties": false,
    "property_keys": [
        {
            "trait_name": "censhare_storage",
            "property_name": "storage"
        }
    ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 6808

{
  "assets": [{
    "asset_id": "21191",
    "version": 1,
    "properties": [{
      "trait_name": "censhare_storage",
      "property_name": "storage",
      "values": [{
        "value_id": "-1",
        "sorting": 1,
        "children": [{
          "trait_name": "censhare_storage",
          "property_name": "key",
          "values": [{
            "value": "master"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "mimeType",
          "values": [{
            "value": "image/jpeg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileSystemName",
          "values": [{
            "value": "assets"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "relPath",
          "values": [{
            "value": "file:13/34/133410.jpg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "state",
          "values": [{
            "value": "0"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileLength",
          "values": [{
            "value": "1733962"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "widthPx",
          "values": [{
            "value": "2100"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "heightPx",
          "values": [{
            "value": "1181"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "colorDepthBits",
          "values": [{
            "value": "8"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "dpi",
          "values": [{
            "value": "72"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "color",
          "values": [{
            "value": "rgb"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "hashCode",
          "values": [{
            "value": "F33BA54222E42C57045C859452CA061B64ADE848"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "sorting",
          "values": [{
            "value": "3"
          }]
        }]
      }, {
        "value_id": "-2",
        "sorting": 2,
        "children": [{
          "trait_name": "censhare_storage",
          "property_name": "key",
          "values": [{
            "value": "preview"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "mimeType",
          "values": [{
            "value": "image/jpeg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileSystemName",
          "values": [{
            "value": "assets"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "relPath",
          "values": [{
            "value": "file:13/35/133556.jpg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "state",
          "values": [{
            "value": "0"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileLength",
          "values": [{
            "value": "94256"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "widthPx",
          "values": [{
            "value": "1000"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "heightPx",
          "values": [{
            "value": "562"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "colorDepthBits",
          "values": [{
            "value": "8"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "dpi",
          "values": [{
            "value": "72"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "color",
          "values": [{
            "value": "rgb"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "hashCode",
          "values": [{
            "value": "B62A306350480ED703D05BAEA597012B59096022"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "sorting",
          "values": [{
            "value": "2"
          }]
        }]
      }, {
        "value_id": "-3",
        "sorting": 3,
        "children": [{
          "trait_name": "censhare_storage",
          "property_name": "key",
          "values": [{
            "value": "thumbnail"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "mimeType",
          "values": [{
            "value": "image/jpeg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileSystemName",
          "values": [{
            "value": "assets"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "relPath",
          "values": [{
            "value": "file:13/35/133557.jpg"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "state",
          "values": [{
            "value": "0"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "fileLength",
          "values": [{
            "value": "9334"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "widthPx",
          "values": [{
            "value": "250"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "heightPx",
          "values": [{
            "value": "140"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "colorDepthBits",
          "values": [{
            "value": "8"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "dpi",
          "values": [{
            "value": "72"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "color",
          "values": [{
            "value": "rgb"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "hashCode",
          "values": [{
            "value": "CED4481326CE19396C7BB80E101F57013562EE00"
          }]
        }, {
          "trait_name": "censhare_storage",
          "property_name": "sorting",
          "values": [{
            "value": "1"
          }]
        }]
      }]
    }]
  }]
}

2.2.2. Example Response

Path Type Description
asset_ids[].

Array

Asset ids to be retrieved

all_properties

Boolean

If true will retrieve all properties related to this asset otherwise none or specified

property_keys[0].trait_name

String

Name of the storage item trait property to be retrieved

property_keys[0].property_name

String

Name of the storage item property to be retrieved

Example Response Payload

Path Type Description
assets[].asset_id

String

The asset id that contains storage items

assets[].version

Number

Asset version

assets[].properties[].trait_name

String

Name of the asset trait property

assets[].properties[].property_name

String

Name of the asset property

assets[].properties[].values[].value_id

String

Unique value of the asset property

assets[].properties[].values[].sorting

Number

Sorting of the asset property

assets[].properties[].property_name

String

Name of the asset property

assets[].properties[].values[].children[]

Array

The storage item property information

2.3. Update an existing asset with storage item (update/delete/crete)

Allows updating,deleting and creating storage items of an existing asset.

2.3.1. Example Request

POST /api/v1/update-assets HTTP/1.1
Content-Type: application/json
Content-Length: 3189
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_id": 21440,
      "properties": [
        {
          "trait_name": "type",
          "property_name": "type",
          "values": [
            {
              "value": "picture."
            }
          ]
        },
        {
          "trait_name": "display",
          "property_name": "name",
          "values": [
            {
              "value": "test asset"
            }
          ]
        },
        {
          "trait_name": "censhare_storage",
          "property_name": "storage",
          "operation": "update",
          "values": [
            {
              "children": [
                {
                  "trait_name": "censhare_storage",
                  "property_name": "key",
                  "values": [
                    {
                      "value": "master"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "mimeType",
                  "values": [
                    {
                      "value": "image/jpeg"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "relPath",
                  "values": [
                    {
                      "value": "file:13/00/130000.jpg"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "state",
                  "values": [
                    {
                      "value": "0"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "fileLength",
                  "values": [
                    {
                      "value": "172927"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "widthPx",
                  "values": [
                    {
                      "value": "1596"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "heightPx",
                  "values": [
                    {
                      "value": "760"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "dpi",
                  "values": [
                    {
                      "value": "144"
                    }
                  ]
                },
                {
                  "trait_name": "censhare_storage",
                  "property_name": "fileSystemName",
                  "values": [
                    {
                      "value": "assets"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Example Request Payload

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

2.3.2. Example Response

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[].asset_id

Number

Asset id to be the storage items properties to be updated.

requests[].properties[].trait_name

String

Name of the asset trait property

requests[].properties[].property_name

String

Name of the asset property

requests[].properties[].operation

String

Operation to be executed on storage item, options: UPDATE, DELETE, CREATE

requests[].properties[].values[].value

String

The properties values details

requests[].properties[].values[].children[]

Array

The storage item property information

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

3. Asset Relations

Introduction

Missing features in Asset Relations:

  • GET Implement the Cursor logic in the legacy-bridge for GET-Relations as this could be a huge response once we start to work with bulk operations. Note: the API already support it.

Asset relations by reference by ID NOTE: Asset relations by reference by id will be treated for the end user as any other relation, sharing the same structure for all CRUD operations flows. The only difference is the value of the field relation_type where instead of having an existing relation type defined, will have the asset feature key.

How does it look like an asset reference by id on an asset XML?

<asset application="default" ccn="374" content_version="1" corpus:dto_flags="t" created_by="10" creation_date="2020-10-14T14:07:06Z" currversion="0" deletion="0" domain="root." domain2="root." has_master_file="0" has_update_geometry="0" id="22721" id_extern="corpus:22721" iscancellation="0" modified_by="10" modified_date="2020-11-25T08:21:57Z" name="parent rel" non_owner_access="0" rowid="73187" state="0" storage_state="0" tcn="373" type="picture." usn="0" version="19" xmlns:corpus="http://www.censhare.com/xml/3.0.0/corpus" xmlns:new-fct="http://www.censhare.com/xml/3.0.0/new-fct" xmlns:new-val="http://www.censhare.com/xml/3.0.0/new-val" z_icon-set-key="assettype-picture.">
  <asset_feature asset_id="22721" asset_version="19" corpus:dto_flags="t" feature="censhare:branding" isversioned="1" party="10" rowid="1545286" sid="1601611" timestamp="2020-11-25T08:25:54Z" value_asset_id="36341" value_id="1601611" value_long="0" value_long2="0"/>
  <asset_feature asset_id="22721" asset_version="19" corpus:dto_flags="t" feature="censhare:uuid" isversioned="1" party="10" rowid="1545285" sid="1601608" timestamp="2020-10-14T14:07:06Z" value_id="1554798" value_string="8a8a2ef0-0e26-11eb-9977-9aa0c02fb5d4"/>
</asset>
Note
the asset_feature → feature="censhare:branding" that contains actually an asset id reference on the field value_asset_id.

3.1. Get Asset Relations

Allows retrieving asset relations using different filter options:

  • You can search all relations that matches a given source asset id

  • You can search all relations that matches a given target asset id

  • You can search for all the relations of a specific asset id

  • You can search all relations between a specific source asset id and specific target id

  • You can search all relations properties or specific ones.

  • Additionally, you can restrict filtering to a specific set of relation types

Note
in the future, pagination will be supported. Asset relations by reference by ids are displayed with same structure but only difference > is on the relation type where is retrieve the asset feature key instead.

3.1.1. Example Request

POST /api/v1/get-asset-relations HTTP/1.1
Content-Type: application/json
Content-Length: 30
Host: localhost:8080

{
    "source_asset_id": 123
}

Example Request Payload

Path Type Description
asset_ids[]

Array

Asset ids to be retrieved

all_properties

Boolean

If true will retrieve all properties related to this asset otherwise none or specified

3.1.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 168

{
  "asset_relations": [{
    "asset_relation_key": {
      "source_asset_id": "123",
      "relation_type": "user.media.",
      "target_asset_id": "5434"
    }
  }]
}

Example Response Payload

Path Type Description
asset_relations[0].asset_relation_key.source_asset_id

String

Source asset id received

asset_relations[0].asset_relation_key.target_asset_id

String

Target asset id received

asset_relations[0].asset_relation_key.relation_type

String

Relation type received

3.2. Create Asset Relations

3.2.1. Example Request

POST /api/v1/create-asset-relations HTTP/1.1
Content-Type: application/json
Content-Length: 232
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_relation_key": {
        "source_asset_id": 19640,
        "target_asset_id": 19642,
        "relation_type": ["user."]
      }
    }
  ]
}

Example Request Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[0].asset_relation_key.source_asset_id

Number

Source asset id to create the relation

requests[0].asset_relation_key.target_asset_id

Number

Target asset id to create the relation

requests[0].asset_relation_key.relation_type

Array

Relation type to be created

3.2.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

3.3. Delete Asset Relations

Deleting a relations will delete, of course, the properties if available.

3.3.1. Example Request

POST /api/v1/delete-asset-relations HTTP/1.1
Content-Type: application/json
Content-Length: 252
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_relation_key": {
        "source_asset_id": 19640,
        "target_asset_id": 19642,
        "relation_type": [
          "user."
        ]
      }
    }
  ]
}

Example Request Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[0].asset_relation_key.source_asset_id

Number

Source asset id to delete the relation

requests[0].asset_relation_key.target_asset_id

Number

Target asset id to delete the relation

requests[0].asset_relation_key.relation_type[]

Array

Relation type to be deleted

3.3.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

3.4. Update Asset Relations

3.4.1. Example Request

POST /api/v1/update-asset-relations HTTP/1.1
Content-Type: application/json
Content-Length: 558
Host: localhost:8080

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551",
  "requests": [
    {
      "asset_relation_key": {
        "source_asset_id": 22721,
        "target_asset_id": 34130,
        "relation_type": ["user."]
      },
      "properties": [
        {
          "trait_name": "costs",
          "property_name": "budgetAllocated",
          "values": [
            {
              "operation": "UPDATE",
              "value_id": "1587405",
              "value": "100.0",
              "unit": "EUR"
            }
          ]
        }
      ]
    }
  ]
}

Example Request Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action

requests[0].asset_relation_key.source_asset_id

Number

Source asset id to update the relation

requests[0].asset_relation_key.target_asset_id

Number

Target asset id to update the relation

requests[0].asset_relation_key.relation_type

Array

Relation type to be updated

requests[0].properties[0].trait_name

String

Asset trait name property

requests[0].properties[0].property_name

String

Asset property name

requests[0].properties[0].values[0].operation

String

Operation to be executed

requests[0].properties[0].values[0].value_id

String

Unique property identifier that helps to update a specific property

requests[0].properties[0].values[0].value

String

Value to be updated

requests[0].properties[0].values[0].unit

String

Unit to be updated

3.4.2. Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 58

{
  "command_id": "c18e1dd4-371e-4c8a-ad90-619f08a7f551"
}

Example Response Payload

Path Type Description
command_id

String

Command id where kafka produced all related info to this action