How to get global attribute values

Lester Howard

Hello team,

I actually have two questions regarding global attributes.

It is not clear to me how I can add some value to a global attribute if you can help me with the API, on the other hand, is there a way to get all the values of a global attribute?

When I make a request with the following APIs, I received information but not the values present in the global attribute

 

 

 

Thank you

 

Comments

1 comment

  • Comment author
    William Thompson

    Hi Lester, 

    You can use the Asset Import & Export APIs to get/update global attributes and their values. A successful GET (export single asset) request will return an object similar to the following:

    {
      "id": "9b730242-b4a4-4dff-b9f2-f2e2c51c2e9e",
      "name": "Lounge",
      "type": "item",
      "as": null,
      "createdAt": "2021-11-30T21:13:47.121Z",
      "updatedAt": "2022-06-15T18:22:29.288Z",
      "deletedAt": null,
    "createdBy": "42389532-cdc8-4c2f-bb64-57ff68042196",
    "orgId": "a4e19e04-30e4-4360-bba5-4f27f25419d0",
      "metadata": [],
      "tags": [
        "Couch"
      ],
    "keywords": [],
    "proxyId": "13cb99a0-344d-4a35-ae7f-a802d3a6bf47",
      "parentFolderId": "catalog",
      "publishedAt": "2022-06-09T15:57:02.938Z",
      "defaultStageId": "981dcc5d-a3b1-4554-afbc-b27e8edfcbb7",
    "defaultCompositeId": "f6820d3e-ca9a-4cb1-a064-378d987b9666",
      "deletedBy": null,
    "updatedBy": "42389532-cdc8-4c2f-bb64-57ff68042196",
      "proxyType": null,
    "effects": null,
      "fileSize": 9605142,
      "rules": [],
      "attributes": [
        {
          "id": "11bf9665-e016-451c-96b8-e4575a388479",
          "type": "Global",
          "name": "Global",
          "defaultValue": {
            "assetId": "a6ed8d63-01b7-4e83-85f6-2dd1cfda0127",
            "configuration": "",
            "type": "item"
          },
          "proxy": {
            "id": "11bf9665-e016-451c-96b8-e4575a388479",
            "type": "Asset",
            "name": "Color",
            "blacklist": [],
            "assetType": "material",
            "values": [
              "#leather",
              "#fabric"
            ],
            "defaultValue": {
              "configuration": ""
            }
          }
      },
      ],
      "forms": [],
      "script": "",
      "asset": {
        "assetId": "126fa517-2d69-4a38-915a-0149db13737c",
        "configuration": "",
        "type": "model"
      }
    }
    0

Please sign in to leave a comment.