This example shows an HTTP request that can be used to update the labels attached to a publication.
By using the PATCH verb we can send only the affected data in the request body. By contrast, a PUT request could achieve the same result, but the entire data record would have to be supplied in the body request; any missing fields would be deleted from Elements.
The URL and Authorisation header shown here are for illustration only - you should replace them with appropriate values for your system and the task you wish to perform.
HTTP verb: | PATCH |
|---|
Example URL: | https://server-name:8091/secure-api/v5.5/publications/123456 |
|---|
Headers: | Content-Type:text/xml Authorization:Basic dXNlcm5hbWU6cGFzc3dvcmQ= |
|---|
Request body: | <?xml version="1.0" encoding="utf-8"?>
<update-object xmlns="http://www.symplectic.co.uk/publications/api">
<fields>
<!-- add FOR and MeSH labels-->
<field name="labels" operation="add">
<keywords>
<keyword scheme="for">0101 Pure Mathematics</keyword>
<keyword scheme="mesh">1,2-Dimethylhydrazine</keyword>
</keywords>
</field>
<!-- remove a FOR label-->
<field name="labels" operation="remove">
<keywords>
<keyword scheme="for">010101 Algebra and Number Theory</keyword>
</keywords>
</field>
</fields>
</update-object>
|
|---|
| Includes Percentages <?xml version="1.0" encoding="utf-8"?>
<update-object xmlns="http://www.symplectic.co.uk/publications/api" type-name ="book">
<fields>
<!-- add an for and mesh label-->
<field name ="labels" operation="add">
<keywords>
<keyword scheme="for" percentage="30">0101 Pure Mathematics</keyword>
<keyword scheme="mesh" percentage="10">1,2-Dimethylhydrazine</keyword>
</keywords>
</field>
</fields>
</update-object>
</fields>
</update-object>
|