Edit Metadata Collection
/documents/api/1.2/metadata/{collectionName}
Add or remove fields in a specified metadata collection.
Enable or disable a metadata collection.
Request
- application/json
- application/xml
-
collectionName: string
Collection name. For a user personal collection, it must start with
Personal.
, such asPersonal.MyCollection
.
object
Description of fields available to edit fields in a metadata collection request. There are no required attributes.
-
addFields(optional):
string
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
andfield 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(optional):
array addFieldsArray
Can be used instead of
addFields
parameter if more granular control over added fields is desired. If bothaddFields
andaddFieldsArray
are supplied, then the former will be ignored. -
removeFields(optional):
string
Specify the names of one or more fields to delete, separated by commas.
-
settings(optional):
string
Enable or disable a metadata collection.
Possible values are:
- enable
- disable
array
addFields
parameter if more granular control over added fields is desired. If both addFields
and addFieldsArray
are supplied, then the former will be ignored.object
-
defaultValue(optional):
string
Default value of the field. If the
fieldType
isdate
, the value should be in theyyyy-mm-ddThh:mm:ss
form. Forboolean
types, valid values should be (1) fortrue
and (0) forfalse
. -
fieldDescription(optional):
string
Description of the field.
-
fieldName(optional):
string
Field names as described for
addFields
input parameter. -
fieldType(optional):
string
Type of the field.
Possible values are:
- text (default)
- number
- date
- boolean
{
"addFields":"FieldX,FieldY,FieldZ",
"removeFields":"FieldA,FieldB",
"settings":"enable"
}
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
object
-
errorCode(optional):
number
An error code of zero (0) indicates no errors.
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, 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" }