REST Api - Add Metadata
Operation to add metadata to a record using http-post.
Synopsis
Submit
POST /<RESTServletPath>/<RecordID>_log \ ?max-sequence-number=<MaxSequenceNumber>&format=<Format>&force=<Force> HTTP/1.1 Content-Length: <ContentLength> Content-Type: application/x-www-form-urlencoded
Fields:
- RESTServletPath
- Path to the REST Servlet on the host. Example: records
- RecordID
- The unique ID of the stored record. (The SHA1 hash of the stored data)
- RESTHost
- IP address of Shared Records server. Example: sra.sharedrecords.org
- RESTPort
- Network port of the Shared Records server. Example: 8080
Parameters:
- max-sequence-number
- The maximum sequence known sequence number at the time of the request. If this information is out of date the server will respond with a 412 (precondition failed). If you wish to append to the last metadata entry and not specify a sequence number, set this to be -1 or do not include this parameter at all.
- format
- The format of the metadata in the body, either "json", "xml", or "s3".
- force
- Whether to force the addition of this entry even if there is no record associated with the id. Should be "true" or "false". If not specified the default value is "false".
Headers:
- If the "s3" format is used, the required headers must be included.
Body:
The body of the request contains the metadata, formatted as specified in the "format" parameter. This can either be an array of entries to add in the specified format, or a single entry's body if binary format is specified. For details, see MetaDataFormats.
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=iso-8859-1 Content-Length: 0
Headers:
- Content-Type
- The default text/html mime-type.
- Content-Length
- Should be zero, because no data is returned in the body.
Body:
None.
Examples
Command-line
The following command-line example uses the common unix "curl" utility to add metadata formtted as XML to a record.
$ curl --verbose --data @original.txt.1.meta.xml \ "http://sra.sharedrecords.org/records/8e636b1c0af14814fc67748ab54a3aa7d01893fb_log?max-sequence-number=0&format=xml"
Note: the "\" character is used to indicate that the line continues. To copy-and-paste this command, remove those characters and any whitespace in the URI.
