Class ItemMetadataValueAddPatchOperation


  • public class ItemMetadataValueAddPatchOperation
    extends MetadataValueAddPatchOperation<Item>
    Submission "add" PATCH operation. Path used to add a new value to an existent metadata: "/sections/<:name-of-the-form>/<:metadata>/-" Example: curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title/-", "value": {"value": "Add new title"}}]' Path used to insert the new metadata value in a specific position: "/sections/<:name-of-the-form>/<:metadata>/<:idx-zero-based>" Example: curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title/1", "value": {"value": "Add new title"}}]' Path used to initialize or replace the whole metadata values: "/sections/<:name-of-the-form>/<:metadata>" Example: curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title", "value": [{"value": "Add new first title"}, {"value": "Add new second title"}]}]' Please note that according to the JSON Patch specification RFC6902 to initialize a new metadata in the section the add operation must receive an array of values and it is not possible to add a single value to the not yet initialized "/sections/<:name-of-the-form>/<:metadata>/-" path. NOTE: If the target location specifies an object member that does exist, that member's value is replaced.
    Author:
    Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)