Edit Status or Fields in a Metadata Collection

put

/documents/api/1.1/metadata/{collectionName}

Add or remove fields in a specified metadata collection.

Enable or disable a metadata collection.

Request

Supported Media Types
  • application/json
  • application/xml
Path Parameters
collectionName
Type: string
Required: true
Collection name. For a user personal collection, it must start with Personal., such as Personal.MyCollection.
Body Parameter
The request body defines the details of edit fields or the enable/disable status in a metadata collection request.
Root Schema : CollectionEditBody

Description of fields available to edit fields in a metadata collection request. There are no required attributes.

Example application/json

{
    "addFields":"FieldX,FieldY,FieldZ",
    "removeFields":"FieldA,FieldB",
    "settings":"enable"
}

Response

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

The request was fulfilled.

Body
The response body includes information about edit fields in a metadata collection operation.
Root Schema : CollectionEditResponse
The response body includes information about edit fields in a metadata collection operation.
400 Response

Request parameters are not formatted correctly.

A collection with that name does not exist.

Examples

The following example adds two fields, B3 and B4, and removes field B2 from the CollectionB metadata collection. Also, it disables CollectionB.

PUT .../metadata/CollectionB

Request Header

None.

Request Body

{
    "addFields": "B3,B4",
    "removeFields": "B2"
    "settings" : "disable"
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode": "0"
}

Example 2

The following example adds two fields, A3 and A4, and removes field A2 from the Personal.CollectionA metadata collection. Also, it disables Personal.CollectionA.

PUT .../metadata/Personal.CollectionA

Request Header

None.

Request Body

{
    "addFields": "A3,A4",
    "removeFields": "A2"
    "settings" : "disable"
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode": "0"
}

Example 3

The following example attempts to edit the definition of a collection that does not exist.

PUT .../metadata/Personal.CollectionAB

Request Header

None.

Request Body

{
    "addFields": "A3,A4",
    "removeFields": "A2"
    "settings" : "disable"
}

HTTP Status Code

HTTP_STATUS = 404

JSON Response

{
    "errorCode": "-16",
    "errorKey": "!csUnableToEditMetaColDef!csMetaCollectionDoesntExist,Personal.CollectionAB",
    "errorMessage": "Unable to edit metadata collection definition. Metadata Collection 'Personal.CollectionAB' is not defined.",
    "title": "Unable to edit metadata collection definition. Metadata Collection 'Personal.CollectionAB' is not defined.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

Example 4

The following example attempts to edit the definition of a collection using invalid characters in the name.

PUT .../metadata/Personal.CollectionA,B

Request Header

None.

Request Body

{
    "addFields": "A3,A4",
    "removeFields": "A2"
    "settings" : "disable"
}

HTTP Status Code

HTTP_STATUS = 400

JSON Response

{
    "errorCode": "-96",
    "errorKey": "!csCollectionNameInvalidCharacters,Personal.CollectionA\\,B",
    "errorMessage": "Invalid characters in the collection name 'Personal.CollectionA,B'.",
    "title": "Invalid characters in the collection name 'Personal.CollectionA,B'.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}