Get Available Metadata Collections

get

/documents/api/1.2/metadata

Retrieve all metadata collections available for the current user. The result list includes all global metadata collections for that tenant as well as all personal metadata collections created by the current user. By default, only metadata collection definitions will be retrieved, but all respective field definitions can be obtained as well, if needed.

Request

Supported Media Types
Body ()
The request body defines the details of retrieving metadata collections available for the current user. It is not required, and it will retrieve only metadata collections by default. If fields need to be retrieved as well, retrieveFields can be used.
Root Schema : AvailableCollectionsRequestBody
Type: object
The request body defines details of the get all available collections request.
Show Source
Example Request (application/json)
{
    "retrieveFields":"1"
}
Back to Top

Response

Supported Media Types

200 Response

The request was fulfilled.

Body ()
Root Schema : AllAvailableCollectionsResponse
Type: object
The response body includes information about all available collections for the current user.
Show Source
Nested Schema : metadataCollections
Type: array
Show Source
Nested Schema : CollectionDefinition
Type: object
Metadata collection definition.
Show Source
Nested Schema : items
Type: array
List of field definitions.
Show Source
Nested Schema : CollectionFieldDefinition
Type: object
Metadata fields definition.
Show Source

400 Response

Request parameters are not formatted correctly.

Back to Top

Examples

The following example returns all available metadata collections for the current user. By default, only collection information is retrieved. All global collections created by an admin user and all personal collections created by the current user are retrieved. The URL request in the example has the same effect as passing the query parameter "retrieveFields=0".

GET .../metadata

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode": "0",
    "metadataCollections": {
        "GlobalCollectionA": {
            "isEnabled": "1",
            "type": "collection"
        },
        "GlobalCollectionB": {
            "isEnabled": "0",
            "type": "collection"
        },
        "Personal.MyUserAMetadata": {
            "isEnabled": "1",
            "type": "collection"
        }
    }
}

Example 2

The following example returns all available metadata collections for the current user. All collections and their respective fields are retrieved, including all global collections created by an admin user and all personal collections created by the current user.

GET .../metadata?retrieveFields=1

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode": "0",
    "metadataCollections": {
        "GlobalCollectionA": {
            "isEnabled": "1",
            "type": "collection",
            "items": [
                {
                    "type": "field",
                    "fieldName": "globalFieldA1",
                    "fieldType": "string",
                    "isEnabled": "1"
                },
                {
                    "type": "field",
                    "fieldName": "globalFieldA2",
                    "fieldType": "string",
                    "isEnabled": "0"
                }
            ]
        },
        "GlobalCollectionB": {
            "isEnabled": "0",
            "type": "collection",
            "items": [
                {
                    "type": "field",
                    "fieldName": "globalFieldB1",
                    "fieldType": "string",
                    "isEnabled": "1"
                },
                {
                    "type": "field",
                    "fieldName": "globalFieldB2",
                    "fieldType": "string",
                    "isEnabled": "1"
                }
            ]
        },
        "Personal.MyUserAMetadata": {
            "isEnabled": "1",
            "type": "collection",
            "items": [
                {
                    "type": "field",
                    "fieldName": "myField1",
                    "fieldType": "string",
                    "isEnabled": "0"
                },
                {
                    "type": "field",
                    "fieldName": "myField2",
                    "fieldType": "string",
                    "isEnabled": "1"
                }
            ]
        }
    }
}

Example 3

The following example requests all available metadata collections for the current user. Although an optional parameter, the "retrieveFields" query parameter supports only the values 0 (collections only) and 1 (collections and fields). If any other value is provided, an error is returned.

GET .../metadata?retrieveFields=abc

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 400

JSON Response

{
    "errorCode": "-96",
    "errorKey": "!csInvalidFieldValue,abc",
    "errorMessage": "'abc' is not a valid field value.",
    "title": "'abc' is not a valid field value.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
Back to Top