Managing Resource Registries with REST Interface

Loading Records Through the
Registry’s REST Interface
Ray Plante
National Institute of Standards and Technology (NIST)
NIST Software Development Team:
Mary Brady, Alden Dima, Guillaume Sousa Amaral, Ben Long, Pierre Francois Rigodiat,
Xavier Schmitt, Sharief Youssef
Why use the REST Interface?
You have more than a few records you would like to publish
You have the metadata describing your data assets already stored in a
local data management system
You wish to programmatically to convert that metadata into the format
appropriate for loading into the registry.
You want to automatically update or create resource descriptions as
you holdings evolve
5 April 2017
RDA Plenary 9 -- Barcelona
2
Overview of the Process
1.
Create a login account with the registry
2.
Create a script to format resource metadata into XML
using the resource description XML Schema used by the registry
3.
Validate that the generated records comply with the schema
4.
Upload each record into the registry through its REST interface
Use our Python client module
5.
Review the records through web browser interface; make any
desired changes
6.
Publish the results
Makes them discoverable to the search interface
Records are shared with other registries through the harvesting interface
5 April 2017
RDA Plenary 9 -- Barcelona
3
Documentation and tools
Will post tutorial documentation and pointers to tools to WG RDA
web page
rd-alliance.org -> Groups -> Working Groups -> Materials Resource Registries
https://www.rd-alliance.org/groups/working-group-international-materials-resource-registries.html
 
How-to
XML Schema, example records
XML validater
Python Client (script and library)
5 April 2017
RDA Plenary 9 -- Barcelona
4
XML Schema
Schema is available from GitHub
github.com/usnistgov/mgi-resmd
Master
 branch = aspirational, standards-oriented, extensible
Branch 
feb2017 
contains version currently in use
schemas/xml/res-md.xsd
Example records:  examples/xml
XML Validation
If you work with XML, you probably already have a tool that validates XML
against a schema
If not, try Junx
github.com/RayPlante/junx 
 a library of XML utilities that includes a Schema validater
Based Java Xerxes validating parser
Type: 
validate 
S schemaLocation.txt 
yourfile.xml
schemaLocation.txt
 gives the location of the 
res-md.xml
 on your local disk
5 April 2017
RDA Plenary 9 -- Barcelona
5
The Registry’s REST Interface
See /docs/api
5 April 2017
RDA Plenary 9 -- Barcelona
6
Using the curate operation
Inputs
title 
 a unique name to give to the record
schema 
 internal id for the resource type
Available from the /rest/templates/select/all operation
For public registry at NIST, we will include these in the documentation
Bake the look-up into the Python client
content 
 XML text of the record as a string
POST as form-encoded parameters
Use username, password authentication
curl 
F title=myfile 
F schema=
 58e3b0febd2a3d29d1250123 
F ‘content=<myfile.xml’ \
       --user mylogin https://matsci.nist.gov/rest/curate
5 April 2017
RDA Plenary 9 -- Barcelona
7
Using a Python client
(Registry is based on the Materials Data Curation System application)
Zachary Trautt’s MDCS-api-tools:  a general Python client for MDCS
Provides a Python library and command line script for more easily working
with the REST interface:
At GitHub:  
github.com/MDCS-community/MDCS-api-tools
Will be posting a branch for specifically interacting with Registry
Don’t need to know IDs or indicate the type of resource
registry-api -u mylogin 
url 
https://matsci.nist.gov
 
curate myfile.xml
5 April 2017
RDA Plenary 9 -- Barcelona
8
Check results through the browser
Browse your unpublished records through the Dashboard
5 April 2017
RDA Plenary 9 -- Barcelona
9
Click “Publish”
 
At the moment, it’s not possible to ”publish” from the REST API
5 April 2017
RDA Plenary 9 -- Barcelona
10
Slide Note
Embed
Share

Learn how to efficiently load records into resource registries using a REST interface. This guide covers creating a login account, formatting metadata into XML, validating records, uploading records, reviewing changes, and making records discoverable. Also, discover documentation, tools, and XML schema resources to enhance your registry management process effortlessly.

  • Resource Registries
  • REST Interface
  • Metadata Management
  • XML Schema
  • Registry Loading

Uploaded on Oct 05, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. MATERIALS RESOURCE REGISTRIES Working Group RDA Plenary 9 Barcelona 5 April 2017 Loading Records Through the Registry s REST Interface Ray Plante National Institute of Standards and Technology (NIST) NIST Software Development Team: Mary Brady, Alden Dima, Guillaume Sousa Amaral, Ben Long, Pierre Francois Rigodiat, Xavier Schmitt, Sharief Youssef

  2. MATERIALS RESOURCE REGISTRIES WG Why use the REST Interface? You have more than a few records you would like to publish You have the metadata describing your data assets already stored in a local data management system You wish to programmatically to convert that metadata into the format appropriate for loading into the registry. You want to automatically update or create resource descriptions as you holdings evolve 5 April 2017 RDA Plenary 9 -- Barcelona 2

  3. MATERIALS RESOURCE REGISTRIES WG Overview of the Process 1. Create a login account with the registry 2. Create a script to format resource metadata into XML using the resource description XML Schema used by the registry 3. Validate that the generated records comply with the schema 4. Upload each record into the registry through its REST interface Use our Python client module 5. Review the records through web browser interface; make any desired changes 6. Publish the results Makes them discoverable to the search interface Records are shared with other registries through the harvesting interface 5 April 2017 RDA Plenary 9 -- Barcelona 3

  4. MATERIALS RESOURCE REGISTRIES WG Documentation and tools Will post tutorial documentation and pointers to tools to WG RDA web page rd-alliance.org -> Groups -> Working Groups -> Materials Resource Registries https://www.rd-alliance.org/groups/working-group-international-materials-resource-registries.html How-to XML Schema, example records XML validater Python Client (script and library) 5 April 2017 RDA Plenary 9 -- Barcelona 4

  5. MATERIALS RESOURCE REGISTRIES WG XML Schema Schema is available from GitHub github.com/usnistgov/mgi-resmd Master branch = aspirational, standards-oriented, extensible Branch feb2017 contains version currently in use schemas/xml/res-md.xsd Example records: examples/xml XML Validation If you work with XML, you probably already have a tool that validates XML against a schema If not, try Junx github.com/RayPlante/junx a library of XML utilities that includes a Schema validater Based Java Xerxes validating parser Type: validate S schemaLocation.txt yourfile.xml schemaLocation.txt gives the location of the res-md.xml on your local disk 5 April 2017 RDA Plenary 9 -- Barcelona 5

  6. MATERIALS RESOURCE REGISTRIES WG The Registry s REST Interface See /docs/api 5 April 2017 RDA Plenary 9 -- Barcelona 6

  7. MATERIALS RESOURCE REGISTRIES WG Using the curate operation Inputs title a unique name to give to the record schema internal id for the resource type Available from the /rest/templates/select/all operation For public registry at NIST, we will include these in the documentation Bake the look-up into the Python client content XML text of the record as a string POST as form-encoded parameters Use username, password authentication curl F title=myfile F schema= 58e3b0febd2a3d29d1250123 F content=<myfile.xml \ --user mylogin https://matsci.nist.gov/rest/curate 5 April 2017 RDA Plenary 9 -- Barcelona 7

  8. MATERIALS RESOURCE REGISTRIES WG Using a Python client (Registry is based on the Materials Data Curation System application) Zachary Trautt s MDCS-api-tools: a general Python client for MDCS Provides a Python library and command line script for more easily working with the REST interface: At GitHub: github.com/MDCS-community/MDCS-api-tools Will be posting a branch for specifically interacting with Registry Don t need to know IDs or indicate the type of resource registry-api -u mylogin url https://matsci.nist.gov curate myfile.xml 5 April 2017 RDA Plenary 9 -- Barcelona 8

  9. MATERIALS RESOURCE REGISTRIES WG Check results through the browser Browse your unpublished records through the Dashboard 5 April 2017 RDA Plenary 9 -- Barcelona 9

  10. MATERIALS RESOURCE REGISTRIES WG Click Publish At the moment, it s not possible to publish from the REST API 5 April 2017 RDA Plenary 9 -- Barcelona 10

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#