Edit Metadata Collection

put

/documents/api/1.2/metadata/{collectionName}

Add or remove fields in a specified metadata collection.

Enable or disable a metadata collection.

Request

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

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

Show Source
  • Add one or more field names, separated by commas. You can add and remove fields after the collection is created. Field names must be unique within the collection.

    The following restrictions apply to collection and field names:

    • Collection and field names can't start or end with a space.
    • The combined length of the collection and field name can't exceed 240 characters.
    • Collection and file names aren't case-sensitive; that is, Field Name and field name are considered identical.

    Don't use the following characters in collection or field names:

     / \ < > [ ] { } = $ %
     ' * " ? : # & ^ . , |

    The following strings are also not allowed in collection or field names:

    • NUL
    • NULL
    • xSystem
    • xUser
    • xAF
    • dMetadataUnitID
    • dParentMetadataUnitID
    • dMetadataInheritLevel
    • dAssignedMetaCollection
    • dMetaCollection
    • dMetaCollections
    • dMetadataCollectionID
    • dMetadataID

  • addFieldsArray
    Can be used instead of addFields parameter if more granular control over added fields is desired. If both addFields and addFieldsArray are supplied, then the former will be ignored.
  • Specify the names of one or more fields to delete, separated by commas.
  • Enable or disable a metadata collection.

    Possible values are:

    • enable
    • disable

Nested Schema : addFieldsArray
Type: array
Can be used instead of addFields parameter if more granular control over added fields is desired. If both addFields and addFieldsArray are supplied, then the former will be ignored.
Show Source
Nested Schema : items
Type: object
Show Source
Example Request (application/json)
{
    "addFields":"FieldX,FieldY,FieldZ",
    "removeFields":"FieldA,FieldB",
    "settings":"enable"
}
Back to Top

Response

Supported Media Types

200 Response

The request was fulfilled.

Body ()
Root Schema : CollectionEditResponse
Type: object
The response body includes information about edit fields in a metadata collection operation.
Show Source

400 Response

Request parameters are not formatted correctly.

A collection with that name does not exist.

Back to Top

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, FieldE and FieldF (with type, description and with or without default value), and removes field FieldA from the Personal.CollectionA metadata collection. Also, it disables Personal.CollectionA.

PUT .../metadata/Personal.CollectionA

Request Header

None.

Request Body

{
    "addFieldsArray":[
        {"fieldName":"FieldE", "fieldType":"text", "fieldDescription":"Field E"},
        {"fieldName":"FieldF", "fieldType":"number", "fieldDescription":"Field F", "defaultValue":345}
    ],
    "removeFields": "FieldA",
    "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"
}
Back to Top