Metadata APIs

Add 1st Level Metadata Category

OVERVIEW

Overview

Add 1st level Metadata Category to Publisher

This API call is used to add an individual Metadata Category to an existing Metadata node. 

Since v5.1

HTTP Request

POST  /api/2/metadata/<ID>/categories

OR

POST  /api/2/metadata/<NAME>/categories

URL Parameters
Parameter Description
ID The ID of the metadata node to update
NAME The name of the metadata node to update

 

HTTP Request Object

Metadata object, either in JSON or XML format.

 

HTTP Headers
HTTP Request Header Description Example
Authorization The API Authorisation token "Bearer XXXXXXXXXXXXX"
Accept

The format of the expected response. 

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the default response given.

"application/xml"
Content-Type

The format of the provided content.

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the expected content by default.

"application/json"

 

HTTP Response

Success

HTTP response 200 with Metadata summary object for the parent metadata object

(Example below)

 

 

Example HTTP Request & Response

Example: Metadata with 1 level

POST http://example.com/context/api/2/metadata/34/categories

 

{

    "category": {

        "category": "England",

        "status": "active",

        "externalmappingname": "Eng",

        "internalmappingname": "EN",

        "externalids": [

            "england",

            "eng",

        ],

        "imagename": "england-flag",

        "translations": {

            "en_GB": "England",

            "fr_FR": "Angleterre"

        }

    }

}

 

 

JSON Response

{

    "metadata": {

            "id": 34,

            "name": "Countries",

            "link": "http://example.com/context/api/2/metadata/34"

    }

}

 

 

Example: Metadata with 2 level - entire tree

POST http://example.com/context/api/2/metadata/46/categories

 

{

    "category": {

        "category": "Africa",

        "translations": {

            "en_GB": "Africa",

            "fr_FR": "Afrique"

        },

        "labels": [

            {

                "name": "Algeria",

                "status": "active",

                "externalmappingname": "Alg",

                "internalmappingname": "DZ",

                "externalids": [

                    "algeria",

                    "alg",

                },

                "imagename": "algeria-flag",

                "translations": {

                    "en_GB": "Algeria",

                    "fr_FR": "Algérie"

                }

            },

            {

                "name": "Angola",

                "status": "active",

                "externalmappingname": "Ang",

                "internalmappingname": "AO",

                "externalids": [

                    "angola",

                    "ang",

                },

                "imagename": "angola-flag",

                "translations": {

                    "en_GB": "Angola",

                    "fr_FR": "Angola"

                }

            }

        ]

    }

}

JSON Response

{

    "metadata": {

            "id": 46,

            "name": "Countries",

            "link": "http://example.com/context/api/2/metadata/46"

    }

}

 

Example: Metadata with 2 level - just the category node

POST http://example.com/context/api/2/metadata/46/categories

 

{

    "category": {

        "category": "Africa",

        "translations": {

            "en_GB": "Africa",

            "fr_FR": "Afrique"

        }

    }

}

JSON Response

{

    "metadata": {

            "id": 46,

            "name": "Countries",

            "link": "http://example.com/context/api/2/metadata/46"

    }

}

Comments


0 Comments

Last Updated: Nov 08,2024