Get Available Metadata Collection

get

/documents/api/1.1/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
  • application/json
  • application/xml
Body Parameter
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
The request body defines details of the get all available collections request.
Example application/json

{
    "retrieveFields":"1"
}

Response

Supported Media Types
  • application/json
  • application/xml
200 Response

The request was fulfilled.

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

Request parameters are not formatted correctly.

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"
}