{"id":3737,"date":"2021-12-17T16:28:52","date_gmt":"2021-12-17T16:28:52","guid":{"rendered":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/?p=3737"},"modified":"2021-12-20T09:38:51","modified_gmt":"2021-12-20T09:38:51","slug":"new-feature-in-edinburgh-datashare-the-rest-api","status":"publish","type":"post","link":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/2021\/12\/17\/new-feature-in-edinburgh-datashare-the-rest-api\/","title":{"rendered":"New feature in Edinburgh DataShare: the REST API"},"content":{"rendered":"<p>Ever wanted to get a table of the details of all the datasets on DataShare to do with Scottish history? Or matching some other criteria, possibly on specified fields? If so, the new API (Application Programming Interface) can help.<\/p>\n<p>DataShare now has a REST API, which you can use to query our metadata. An API makes the database\u2019s contents accessible for requests from external servers, through a command-line, which allows external users to script such requests. The DSpace API also provides its own web-based query client and report client. These pages allow users to use a graphical interface to quickly build a query and see the results in a table, all in the browser.<\/p>\n<p>The DataShare REST API page starts with a link to our plain-English explanation of how the API can be used:<\/p>\n<p><a href=\"https:\/\/datashare.ed.ac.uk\/rest\">Edinburgh DataShare DSpace REST API\u00a0<\/a><\/p>\n<p><strong>We would like to hear from anyone who wants to use the API. Please try it out and let us know what you find useful! <\/strong>Email us at <a href=\"mailto:data-support@ed.ac.uk\">data-support@ed.ac.uk<\/a> .<\/p>\n<h2>Examples using the graphical query builder<\/h2>\n<p>I wanted to find datasets where I could add a link to the associated publication. This is a bit of a challenge for us, since users typically deposit their data with us under embargo before the associated paper has been published, and we do not have an automatic way to detect when or whether an associated publication has appeared. \u00a0I used the query builder to find the IsReferencedBy value for deposits accessioned in 2017. The plain-English guide on the wiki provides the steps I went through to do so:<\/p>\n<p><a href=\"https:\/\/www.wiki.ed.ac.uk\/display\/datashare\/How+to+use+the+DataShare+REST+API\">How to use the DataShare REST API\u00a0<\/a><\/p>\n<p>This feature may be of use to colleagues who support organisational units at University of Edinburgh which don\u2019t align precisely with the Collections structure of DataShare \u2013 the API lets you query on multiple collections through the reporting tool. We\u2019d love for colleagues to contact us if their teams have published a new paper containing a data citation of their DataShare deposit, so we can add the details of the publication to the DataShare Item\u2019s metadata, resulting in a hyperlink appearing on the dataset landing page.<\/p>\n<p>I wanted to find datasets with an embargo date in December. This is a challenge for us because users often set their embargo expiry date to Hogmanay, which means their one-week reminder would arrive on Christmas Day right in the middle of the university&#8217;s winter break. But many other fields contain dates with December in them, so it has not been practical for me to search for this using the graphical interface. So I used the API to search specifically in the dc.date.embargo field. See the screenshot below. The API helped me find the datasets whose embargo date we needed to extend, or else lift the embargo outright, allowing us to contact the depositors in good time to ask them whether a paper had been published or more time was needed.<\/p>\n<div id=\"attachment_3739\" style=\"width: 594px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-3739\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-3739 size-large\" src=\"http:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo-1024x618.png\" alt=\"Screenshot of the output of the REST API\" width=\"584\" height=\"352\" srcset=\"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo-1024x618.png 1024w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo-300x181.png 300w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo-768x464.png 768w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo-497x300.png 497w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/REST-API-Hogmanay-embargo.png 1391w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><p id=\"caption-attachment-3739\" class=\"wp-caption-text\">Results showing datasets with an embargo date in December 2021<\/p><\/div>\n<p>Thirdly, to demonstrate the power of this tool relative to the non-specific Search I chose a topic with very common words to show how to use the query builder to focus in on results avoiding spurious matches.<\/p>\n<p>Using the existing &#8216;Search&#8217; function on the homepage I searched for &#8216;history Scotland&#8217;. This produced 39 matches, some of which have nothing to do with historical research or Scotland, but merely mention a funder &#8220;NHS Research Scotland&#8221;, and mention the history of the research field in passing to provide a little context. Most of the matches are interesting, but some are not relevant.<\/p>\n<p>Whereas when I set the API query builder to search for &#8216;history&#8217; in the research area (subject classification), and &#8216;Scotland&#8217; in the field for geographical metadata ie dc.coverage.spatial. This provided me with a short list of high quality matches, three datasets of historical research to do with Scotland &#8211; see the screenshot. This is a useful tool for narrowing a search.<\/p>\n<div id=\"attachment_3742\" style=\"width: 594px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-3742\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-3742 size-large\" src=\"http:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790-697x1024.png\" alt=\"Screenshot showing the input, and the output on the API query builder webpage\" width=\"584\" height=\"858\" srcset=\"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790-697x1024.png 697w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790-204x300.png 204w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790-768x1128.png 768w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790-1045x1536.png 1045w, https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/files\/2021\/12\/Scottish-History-through-the-API-e1639993026790.png 1087w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><p id=\"caption-attachment-3742\" class=\"wp-caption-text\">A search for two very common words in specific fields produces high quality results<\/p><\/div>\n<h2>Enabling the API<\/h2>\n<p>The REST API is a feature of the underlying DSpace repository software. Our sysadmins configured the API with great care to block certain commands and enable only the &#8216;GET&#8217; commands that are needed for appropriate queries using DSpace config settings (further info\u00a0<a href=\"https:\/\/wiki.lyrasis.org\/display\/DSDOC6x\/DSpace+6.x+Documentation\">DSpace 6 Documentation on the Lyrasis wiki<\/a>\u00a0).<\/p>\n<h2>The Future<\/h2>\n<p>In the international DSpace repository community, we\u2019re aware the API is used for integration with at least one CRIS (Current Research Information System) and quality tool applications (Andrea Bollini, 4Science, private communication). We understand the API of the newer DSpace 7 contains significant changes compared to that of DSpace 6, which we\u2019re using for Edinburgh DataShare.<\/p>\n<p>We\u2019re aware of only a few examples of the API being used by individuals for occasional metadata queries. But we will watch with interest to see how the DSpace 7 API will be used.<\/p>\n<p>&nbsp;<\/p>\n<p>Pauline Ward<br \/>\nResearch Data Support Assistant<br \/>\nLibrary and University Collections<br \/>\nUniversity of Edinburgh<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever wanted to get a table of the details of all the datasets on DataShare to do with Scottish history? Or matching some other criteria, possibly on specified fields? If so, the new API (Application Programming Interface) can help. DataShare &hellip; <a href=\"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/2021\/12\/17\/new-feature-in-edinburgh-datashare-the-rest-api\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":180,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false},"categories":[3,9],"tags":[141,136],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/posts\/3737"}],"collection":[{"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/users\/180"}],"replies":[{"embeddable":true,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/comments?post=3737"}],"version-history":[{"count":9,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/posts\/3737\/revisions"}],"predecessor-version":[{"id":3748,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/posts\/3737\/revisions\/3748"}],"wp:attachment":[{"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/media?parent=3737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/categories?post=3737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/libraryblogs.is.ed.ac.uk\/datablog\/wp-json\/wp\/v2\/tags?post=3737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}