Update Metadata Node
OVERVIEW
Overview
This API allows setting and updating Metadata Node settings. The 1st and 2nd level metadata items can be completely overridden with this API, however to add and update individual node items, we suggest you use the 1st and 2nd level Metadata node APIs.
Since v5.0
Updated v5.1
HTTP Request
PUT /api/2/metadata/<ID>
OR
PUT /api/2/metadata/<NAME>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the metadata node to update |
NAME | The name of the metadata node to update |
HTTP Headers
HTTP Request Header | Description | Example |
---|---|---|
Authorization | The API Authorisation token | "Bearer XXXXXXXXXXXXX" |
Accept |
The format of the expected response.
If no parameter is set, JSON is the default response given. |
"application/xml" |
Content-Type |
The format of the provided content.
If no parameter is set, JSON is the expected content by default. |
"application/json" |
HTTP Response
Success
HTTP response 200 with Metadata Node object
(Example below)
Metadata doesn't exist Error
If the requested Metadata node does not exist:
HTTP response 404
{
"error": {
"summary": "The requested metadata does not exist",
"ref": "176",
"link": "https://example.com/context/api/2/error/16598"
}
}
Example HTTP Request & Response
Example: Metadata with 1 level
PUT https://example.com/context/api/2/metadata/45
OR
PUT https://example.com/context/api/2/metadata/department
JSON Request
{
"metadatanodes": {
"categories": [
{
"metadata": [
{
"name": "Finance",
"status": "active",
"translations": {
"en_GB": "Finance",
"fr_FR": "Département Financier"
}
}
]
}
]
}
}
JSON Response
{
"metadatanodes": {
"categories": [
{
"id": 10,
"metadata": [
{
"id": 292,
"name": "Marketing",
"status": "active",
"translations": {
"en_GB": "Marketing",
"fr_FR": "Département Commercial
"
}
},
{
"id": 293,
"name": "Finance",
"status": "active",
"translations": {
"en_GB": "Finance",
"fr_FR": "Département Financier"
}
}
]
}
]
}
}
Example: Metadata with 2 level
PUT https://example.com/context/api/2/metadata/46
OR
PUT https://example.com/context/api/2/metadata/colours
JSON Request
{
"metadatanodes": {
"categories": [
{
"category": "Pink",
"translations": {
"en_GB": "Pink",
"fr_FR": "Rose"
},
"metadata": [
{
"name": "Magenta",
"status": "active",
"translations": {
"en_GB": "Magenta",
"fr_FR": "Magenta"
}
},
{
"name": "Peach",
"status": "active",
"translations": {
"en_GB": "Peach",
"fr_FR": "Pêche"
}
}
]
}
]
}
}
JSON Response
{
"metadatanodes": {
"categories": [
{
"id": 1,
"category": "Pink",
"translations": {
"en_GB": "Pink",
"fr_FR": "Rose"
},
"metadata": [
{
"id": 1,
"name": "Magenta",
"status": "active",
"translations": {
"en_GB": "Magenta",
"fr_FR": "Magenta"
}
},
{
"id": 2,
"name": "Peach",
"status": "active",
"translations": {
"en_GB": "Peach",
"fr_FR": "Pêche"
}
}
]
},
{
"id": 2,
"category": "Blue",
"translations": {
"en_GB": "Blue",
"fr_FR": "Bleu"
},
"metadata": [
{
"id": 59,
"name": "Navy",
"status": "active",
"translations": {
"en_GB": "Navy",
"fr_FR": "Marin"
}
},
{
"id": 60,
"name": "Teal",
"status": "active",
"translations": {
"en_GB": "Teal",
"fr_FR": "Sarcelle"
}
}
]
},
{
"id": 3,
"category": "Green",
"translations": {
"en_GB": "Green",
"fr_FR": "Vert"
},
"metadata": [
{
"id": 61,
"name": "Emerald",
"status": "active",
"translations": {
"en_GB": "Emerald",
"fr_FR": "Émeraude"
}
}
]
}
]
}
}
Comments
0 Comments