A Research Data Repository Service for Managing Metadata Documents based on JSON or XML.
The following example shows the update of the metadata record. As mentioned before the ETag is needed:
metadata-record4json-v2.json:
{
"id": "d5439ccf-af4c-4727-b45b-1aa8b949d60e",
[...]
"relatedIdentifiers": [
[...]
{
"id": 1,
"identifierType": "URL",
"value": "http://localhost:8040/metastore/api/v2/schemas/my_first_json?version=2",
"relationType": "HAS_METADATA"
}
],
[...]
"acls": [
[...]
{
"sid": "guest",
"permission": "READ"
}
]
}
metadata-v2.json:
{
"title": "My second JSON document",
"date": "2018-07-02"
}
$ curl 'http://localhost:8040/metastore/api/v2/metadata/d9c917ee-160e-460c-b169-8f952ab505c7?version=1' -i -X PUT \
-H 'Content-Type: multipart/form-data' \
-H 'If-Match: "2079736072"' \
-F 'record=@metadata-record4json-v2.json;type=application/json' \
-F 'document=@metadata-v2.json;type=application/json'
You can see, that only the ACL entry for “guest” was added. All other properties are still the same. HTTP-wise the call looks as follows:
PUT /metastore/api/v2/metadata/d9c917ee-160e-460c-b169-8f952ab505c7?version=1 HTTP/1.1
Content-Type: multipart/form-data; boundary=6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
If-Match: "2079736072"
Host: localhost:8040
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=record; filename=metadata-record4json-v2.json
Content-Type: application/json
{"id":"d9c917ee-160e-460c-b169-8f952ab505c7","identifier":{"id":3,"value":"(:tba)","identifierType":"DOI"},"creators":[{"id":3,"familyName":null,"givenName":"SELF","affiliations":[]}],"titles":[{"id":3,"value":"Title of first JSON metadata document","titleType":null,"lang":null}],"publisher":"SELF","publicationYear":"2024","resourceType":{"id":3,"value":"JSON_Metadata","typeGeneral":"MODEL"},"subjects":[],"contributors":[],"dates":[{"id":3,"value":"2024-11-25T13:50:06Z","type":"CREATED"}],"relatedIdentifiers":[{"id":2,"identifierType":"URL","value":"https://repo/anyResourceId","relationType":"IS_METADATA_FOR","scheme":null,"relatedMetadataScheme":null},{"id":3,"identifierType":"URL","value":"http://localhost:8040/metastore/api/v2/schemas/my_first_json?version=2","relationType":"HAS_METADATA","scheme":null,"relatedMetadataScheme":null}],"descriptions":[],"geoLocations":[],"language":null,"alternateIdentifiers":[{"id":3,"value":"d9c917ee-160e-460c-b169-8f952ab505c7","identifierType":"INTERNAL"}],"sizes":[],"formats":[],"version":"1","rights":[],"fundingReferences":[],"lastUpdate":"2024-11-25T13:50:06.577Z","state":"VOLATILE","embargoDate":null,"acls":[{"id":null,"sid":"guest","permission":"READ"},{"id":4,"sid":"SELF","permission":"ADMINISTRATE"}]}
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=document; filename=metadata-v2.json
Content-Type: application/xml
{
"title": "My second JSON document",
"date": "2018-07-02"
}
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm--
You will get the new metadata record with the additional ACL entry. Version number of record was incremented by one and ‘lastUpdate’ was also modified by the server.
HTTP/1.1 200 OK
Location: http://localhost:8040/metastore/api/v2/metadata/d9c917ee-160e-460c-b169-8f952ab505c7?version=2
ETag: "-324611405"
Content-Type: application/json
Content-Length: 1477
{
"id" : "d9c917ee-160e-460c-b169-8f952ab505c7",
"identifier" : {
"id" : 3,
"value" : "(:tba)",
"identifierType" : "DOI"
},
"creators" : [ {
"id" : 3,
"givenName" : "SELF"
} ],
"titles" : [ {
"id" : 3,
"value" : "Title of first JSON metadata document"
} ],
"publisher" : "SELF",
"publicationYear" : "2024",
"resourceType" : {
"id" : 3,
"value" : "JSON_Metadata",
"typeGeneral" : "MODEL"
},
"dates" : [ {
"id" : 3,
"value" : "2024-11-25T13:50:06Z",
"type" : "CREATED"
} ],
"relatedIdentifiers" : [ {
"id" : 2,
"identifierType" : "URL",
"value" : "https://repo/anyResourceId",
"relationType" : "IS_METADATA_FOR"
}, {
"id" : 4,
"identifierType" : "URL",
"value" : "http://localhost:8040/metastore/api/v2/metadata/d9c917ee-160e-460c-b169-8f952ab505c7?version=1",
"relationType" : "IS_NEW_VERSION_OF"
}, {
"id" : 3,
"identifierType" : "URL",
"value" : "http://localhost:8040/metastore/api/v2/schemas/my_first_json?version=2",
"relationType" : "HAS_METADATA"
} ],
"alternateIdentifiers" : [ {
"id" : 3,
"value" : "d9c917ee-160e-460c-b169-8f952ab505c7",
"identifierType" : "INTERNAL"
} ],
"version" : "2",
"lastUpdate" : "2024-11-25T13:50:06.71Z",
"state" : "VOLATILE",
"acls" : [ {
"id" : 5,
"sid" : "guest",
"permission" : "READ"
}, {
"id" : 4,
"sid" : "SELF",
"permission" : "ADMINISTRATE"
} ]
}
You will get the updated datacite record with the following changes:
« PREVIOUS | NEXT » |
---|---|