contextData: Adding Extra Data to Assets

Ango Hub allows you to attach arbitrary text data to any asset, in such a way that it will appear, together with the asset, in the final export. We call this data contextData.

contextData is always a JSON dictionary with key/value pairs, for example:

"contextData": {
    "key1": "value1",
    "key2": "value2"
}

Uploading contextData

contextData can be added to assets when uploading them:

  • Through the SDK

  • Through the Upload Data URL function in the UI.

SDK

Upload Data URL

  1. From your project dashboard, navigate to the Assets tab.

  2. Click on the Add Data button.

  3. Enter the Upload Data URL section.

  4. Prepare a JSON containing your asset URLs paired with contextData, like so:

[
  {
    "data": "https://i.imgur.com/CzXTtJV.jpg",
    "externalId": "cute-cat.jpg",
    "contextData": {
      "key1": "value1",
      "key2": "value2"
    }
  },
  {
    "data": "https://i.imgur.com/OB0y6MR.jpg",
    "externalId": "cute-dog.jpg",
    "contextData": {
      "key3": "value3",
      "key4": "value4"
    }
  }
]
  1. Drag and drop the JSON onto the upload box and upload. Your assets will have the contextData paired with them.

Downloading/Viewing contextData

From your project, navigate to the Export tab and click on Export V3. You will obtain the contextData of each of your assets in the export:

[{
  "asset": "https://asset.com/asset.jpg",
  "externalId": "7b7c4903a2ab4b22a47462af682dd7c6",
  "contextData": {
    "key1": "value1"
  },
  "metadata": {},
  "batches": [],
  "task": {
    "taskId": "64e4758e73c32b0015749157",
    "..."
    ],
    "classifications": [],
    "relations": []
  }
}]

Last updated