SetFields
Writes a values to assets
Defined in: setFields.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
SetFields(data, verbose, fields, triggerAssetBasedWorkflow)
For each asset in "data", this endpoint writes the defined field values to the asset.
|
Class Detail
SetFields(data, verbose, fields, triggerAssetBasedWorkflow)
For each asset in "data", this endpoint writes the defined field values to the asset.
- Parameters:
- data
- an array of objects with an asset id and the fields to set.
[ { "id":123456, "fields": [ { "fieldId": "http://purl.org/dc/elements/1.1/ title", "value": "A new value for Dublin Core title", "append": true },... ] },... ] - verbose Optional, Default: false
- Setting this to true will collect a variety of default values for each asset.
- fields Optional
- An array of field id's to collect the values for each asset
- triggerAssetBasedWorkflow Optional, Default: false
- Set to false to avoid chaining other metadata edited workflows
- Returns:
- [{assetInfo}, ... ]
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "A new value for Dublin Core title",
"append": false
}
]
},
{
"id": 201628784,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "A new value for Dublin Core title",
"append": false
}
]
}
]
fields=["http://purl.org/dc/elements/1.1/ title"]
triggerAssetModified=true
Response:
[
{
"id": 201629375,
"fields": {
"http://purl.org/dc/elements/1.1/ title": "A new value for Dublin Core title"
},
"triggerAssetModified": {
"ok": true,
"workflowTriggered": "Renditions/Workflows/moveAsset.xmpwf"
}
},
{
"id": 201628784,
"fields": {
"http://purl.org/dc/elements/1.1/ title": "A new value for Dublin Core title"
},
"triggerAssetModified": {
"ok": true,
"workflowTriggered": "Renditions/Workflows/moveAsset.xmpwf"
}
}
]
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": " append this ",
"append": true
}
]
},
{
"id": 201628784,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": " append that",
"append": true
}
]
}
]
fields=["http://purl.org/dc/elements/1.1/ title"]
Response:
[
{
"id": 201629375,
"fields": {
"http://purl.org/dc/elements/1.1/ title": "A new value for Dublin Core title append this "
}
},
{
"id": 201628784,
"fields": {
"http://purl.org/dc/elements/1.1/ title": "A new value for Dublin Core title append that"
}
}
]
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "DC Title",
"append": false
},
{
"fieldId": "http://purl.org/dc/elements/1.1/ subject",
"value": ["DC Keywords"],
"append": false
}
]
}
]
fields=["http://purl.org/dc/elements/1.1/ title", "http://purl.org/dc/elements/1.1/ subject"]
Response:
[
{
"id": 201629375,
"fields": {
"http://purl.org/dc/elements/1.1/ title": "DC Title",
"http://purl.org/dc/elements/1.1/ subject": [
"DC Keywords"
]
}
}
]
Setting multiple values in a container(CSV) field
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://purl.org/dc/elements/1.1/ subject",
"value": ["value1","value2"],
"append": false
}
]
}
]
fields=["http://purl.org/dc/elements/1.1/ subject"]
Response:
[
{
"id": 201629375,
"fields": {
"http://purl.org/dc/elements/1.1/ subject": [
"value1",
"value2"
]
}
}
]
Writing to data block fields
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock",
"value": [
[
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "textField"
},
{
"fieldId": "http://purl.org/dc/elements/1.1/ subject",
"value": [
"value1",
"value2"
]
}
]
],
"append": false
}
]
}
]
fields=["http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock"]
Response:
[
{
"id": 201631907,
"fields": {
"http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock": [
{
"http://purl.org/dc/elements/1.1/ title": "textField",
"http://purl.org/dc/elements/1.1/ subject": [
"value1",
"value2"
]
}
]
}
}
]
Writing multiple data blocks
/wf/restapi/v2/setFields
Parameters:
data=
[
{
"id": 201629375,
"fields": [
{
"fieldId": "http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock",
"value": [
[
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "textField"
},
{
"fieldId": "http://purl.org/dc/elements/1.1/ subject",
"value": [
"value1",
"value2"
]
}
],
[
{
"fieldId": "http://purl.org/dc/elements/1.1/ title",
"value": "block 2"
},
{
"fieldId": "http://purl.org/dc/elements/1.1/ subject",
"value": [
"block 2"
]
}
]
],
"append": false
}
]
}
]
fields=["http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock"]
Response:
[
{
"id": 201631907,
"fields": {
"http://ns.mediabeacon.com/REST_v2_testing/container/en/1.0/ datablock": [
{
"http://purl.org/dc/elements/1.1/ title": "textField",
"http://purl.org/dc/elements/1.1/ subject": [
"value1",
"value2"
]
},
{
"http://purl.org/dc/elements/1.1/ title": "block 2",
"http://purl.org/dc/elements/1.1/ subject": [
"block 2"
]
}
]
}
}
]