Edit Fields in a Metadata Collection
/documents/api/1.2/metadata/{collectionName}/field
Edit field definitions or status in 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-
fields(optional):
string
Field names, separated by commas.
-
fieldsArray(optional):
array fieldsArray
Can be used instead of
fieldsandsettingsparameters if field definitions need to change in addition to or instead of enabling or disabling the fields. -
settings(optional):
string
Enable or disable metadata fields specified in fields.
Possible values are:
- enable
- disable
arrayfields and settings parameters if field definitions need to change in addition to or instead of enabling or disabling the fields.object-
defaultValue(optional):
string
Default value of the field. If the
fieldTypeisdate, the value should be in theyyyy-mm-ddThh:mm:ssform. Forbooleantypes, valid values should be (1) fortrueand (0) forfalse. -
fieldDescription(optional):
string
Description of the field.
-
fieldName(optional):
string
Field names as described for
fieldsinput parameter. -
isEnabled(optional):
boolean
Enable (1) or disable (0) metadata field. Overrides
settingsvalue for this field.
{
"settings":"disable"
}
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 disables fields B1 and B2 in the CollectionB metadata collection.
PUT .../metadata/CollectionB/field
Request Header
None.
Request Body
{
"fields": "B1,B2",
"settings" : "disable"
}
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{
"errorCode": "0"
}
Example 2
The following example modifies the description of FieldB while enabling it and modifies the description of FieldC while disabling it in the Personal.CollectionA metadata collection.
PUT .../metadata/Personal.CollectionA/field
Request Header
None.
Request Body
{
"fieldsArray":[
{"fieldName":"FieldB", "fieldDescription":"Enabled Field B", "isEnabled":"1"},
{"fieldName":"FieldC", "fieldDescription":"Disabled Field C", "isEnabled":"0"}
]
}
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{
"errorCode": "0"
}
Example 3
The following example attempts to disable fields in a metadata collection using an invalid character in the name.
PUT .../metadata/Personal.CollectionA,B/field
Request Header
None.
Request Body
{
"fields": "A1,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"
}