Get Available Metadata Collections
/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
- application/json
- application/xml
retrieveFields
can be used.object
-
retrieveFields(optional):
number
Retrieve only collections (
0
) or retrieve collections and respective field definitions (1
).
{
"retrieveFields":"1"
}
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
object
-
errorCode(optional):
number
An error code of zero (0) indicates no errors.
-
metadataCollections(optional):
array metadataCollections
array
-
Array of:
object CollectionDefinition
Metadata collection definition.
object
-
isEnabled(optional):
string
Collection enable (
1
) or disable (0
) status. -
isInherited(optional):
string
Collection inherited (
1
) or directly assigned (0
) status. -
items(optional):
array items
List of field definitions.
-
type(optional):
string
Item type
collection
.
array
-
Array of:
object CollectionFieldDefinition
Metadata fields definition.
object
-
fieldDescription(optional):
string
Field description.
-
fieldName(optional):
string
Field name.
-
fieldType(optional):
string
Field type.
-
isEnabled(optional):
string
Field enable (1) or disable (0) status.
-
type(optional):
string
Item type
field
.
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" }