Update Schema
Only users with administrate permission in the ACL can change the administrative metadata and create new versions of an existing schema.
Update a Schema-Record
A schema-record can be updated either using the GUI or using the command line.
Using the GUI
It is possible to update the administrative metadata of a schema-record by clicking on the edit button to the far right of the schema-record. The process is similar to the way a new schema-record is created. In this case, the content of the schema itself cannot be changed. After editing the fields, or changing the ACL, the changes have to be validated. Click the Validate button on the bottom-left and when all the outlines turn green indicating successful validation, click the Submit button.
Using the Command Line
To update a schema-record using the command line, its “ETag” is needed. For getting the “ETag”, first it needs to be retrieved. For retrieving the “Etag”, the identifier of the schema record/ schema needs to be known. More documentation here.
-
Type
curl 'https://matwerk.datamanager.kit.edu/api/v1/schemas/my_first_json' -i -X GET \ -H 'Accept: application/vnd.datamanager.schema-record+json'
in the command line. Replacemy_first_json
with the identifier of the schema to be updated. Then press enter. -
As a result, one receives the metadata schema record sent before and the corresponding “ETag” in the HTTP response header.
-
Type
$ curl 'http://localhost:8040/api/v1/schemas/my_first_json' -i -X PUT \ -H 'Content-Type: multipart/form-data' \ -H 'If-Match: <ETag>' \ -F 'schema=@schema-v2.json;type=application/json'
followed by the updated schema record. Remember to replace<ETag>
with the “ETag” obtained in the previous step and press enter. -
Now the schema record will be updated.
Update an Existing Schema
An existing Schema version cannot be edited. Every update needs to be registered as a new version. To add a new verison of an existing schema, first the identifier of the schema needs to be noted.
The GUI Method
-
Find the schema listing in the Schema Management tab. Click on the edit button to the far right and the Update Metadata Schema window will open up. Select the Schema Document tab.
-
Now make the desired changes in the interactive editor. The changes would be displayed with red-green colour coding. You could also choose to just replace the entire content with the new content, if you don’t want to edit line-by-line.
-
Go back to the Schema Metadata tab once you are done with the editing and click the Validate button and after successful validation, click the Submit button.
-
The submitted schema would then be saved as a new version if it passes the check by MetaStore. The version number will be assigned automatically based on the number of the current version.
Using Command Line
Follow the same steps for updating a schema-record, but remove 'Accept: application/vnd.datamanager.schema-record+json'
from the first step.
More documentation available here