A Research Data Repository Service for Managing Metadata Documents based on JSON or XML.
For updating an existing metadata schema and/or datacite record a valid ETag is needed. The actual ETag is available via the HTTP GET call of the metadata schema record. (see above) Just send an HTTP POST with the updated metadata schema document and/or datacite record.
schema-v2.json:
{
"$schema": "http://json-schema.org/draft/2019-09/schema#",
"$id": "http://www.example.org/schema/json",
"type": "object",
"title": "Json schema for tests",
"default": {},
"required": [
"title",
"date"
],
"properties": {
"title": {
"$id": "#/properties/string",
"type": "string",
"title": "Title",
"description": "Title of object."
},
"date": {
"$id": "#/properties/string",
"type": "string",
"format": "date",
"title": "Date",
"description": "Date of object"
}
},
"additionalProperties": false
}
$ curl 'http://localhost:8040/metastore/api/v2/schemas/my_first_json' -i -X PUT \
-H 'Content-Type: multipart/form-data' \
-H 'If-Match: "855670887"' \
-F 'schema=@schema-v2.json;type=application/json'
HTTP-wise the call looks as follows:
PUT /metastore/api/v2/schemas/my_first_json HTTP/1.1
Content-Type: multipart/form-data; boundary=6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
If-Match: "855670887"
Host: localhost:8040
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=schema; filename=schema-v2.json
Content-Type: application/json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://www.example.org/schema/json",
"type": "object",
"title": "Json schema for tests",
"default": {},
"required": [
"title",
"date"
],
"properties": {
"title": {
"type": "string",
"title": "Title",
"description": "Title of object."
},
"date": {
"type": "string",
"format": "date",
"title": "Date",
"description": "Date of object"
}
},
"additionalProperties": false
}
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm--
As a result, you receive the updated datacite record and in the HTTP response header the new location URL and the ETag.
HTTP/1.1 200 OK
Location: http://localhost:8040/metastore/api/v2/schemas/my_first_json?version=2
ETag: "-1991796919"
Content-Type: application/json
Content-Length: 1016
{
"id" : "my_first_json",
"identifier" : {
"id" : 1,
"value" : "(:tba)",
"identifierType" : "DOI"
},
"creators" : [ {
"id" : 1,
"givenName" : "SELF"
} ],
"titles" : [ {
"id" : 1,
"value" : "Title for my_first_json"
} ],
"publisher" : "SELF",
"publicationYear" : "2024",
"resourceType" : {
"id" : 1,
"value" : "JSON_Schema",
"typeGeneral" : "MODEL"
},
"dates" : [ {
"id" : 1,
"value" : "2024-11-25T13:50:05Z",
"type" : "CREATED"
} ],
"relatedIdentifiers" : [ {
"id" : 1,
"identifierType" : "URL",
"value" : "http://localhost:8040/metastore/api/v2/metadata/my_first_json?version=1",
"relationType" : "IS_NEW_VERSION_OF"
} ],
"alternateIdentifiers" : [ {
"id" : 1,
"value" : "my_first_json",
"identifierType" : "INTERNAL"
} ],
"version" : "2",
"lastUpdate" : "2024-11-25T13:50:05.941Z",
"state" : "VOLATILE",
"acls" : [ {
"id" : 1,
"sid" : "SELF",
"permission" : "ADMINISTRATE"
} ]
}
« PREVIOUS | NEXT » |
---|---|