Skip to content

OSTI API Use Cases

Neal Ensor edited this page Jul 21, 2020 · 1 revision

Introduction

The intention of this wiki is to document some suggested use cases with examples on how to use the OSTI data set API. The python module provided in this github package is intended to facilitate access to the OSTI DOI services for those familiar with python.

For further information on OSTI's Data ID Services, go to www.osti.gov/data-services. To obtain a test or production E-Link account, please send an email to DOEDataID@osti.gov, and an OSTI staff member will work with you on setting up your account.

Example Usage

Download the ostiapi package and install it in your local python library storage from the "ostiapi" folder.

$ pip install .

To use interactively, start a python (2 or 3) interpreter, and import the package.

$ python3
>>> import ostiapi

Reserving a DOI for unpublished data set

If you wish to obtain a placeholder DOI for an upcoming or unpublished data set, you may reserve a DOI value once you have an active ELINK user account. This placeholder may contain as much relevant metadata information as you would like, but it is especially recommended to provide an "accession_num" value of your creation that uniquely identifies your data set. Upon registering a placeholder DOI value, you will need to provide this accession number or the service-generated OSTI ID value in order to activate or edit the metadata with OSTI.

In order to reserve a DOI within python on OSTI's test platform:

>>> record={"title":"My placeholder data set", "accession_num":"example-ds-0001" }
>>> ostiapi.testmode()
>>> ostiapi.reserve(data, 'myusername', 'mypassword')
{'record': {'osti_id':1487626, 'accession_num':'example-ds-0001', 'title':'My placeholder data set', 'doi_status':'RESERVED', 'doi':'10.11578/1487626,
'status':'SUCCESS', 'status_message':None, '@status':'NEW'}}

Note the OSTI ID value (1487626) uniquely identifies your registration on OSTI, and the doi_status indicates the DOI (10.11578/1487626) is RESERVED. The submission "status" value of "SUCCESS" shows the reservation was placed correctly; if errors occurred, they would be reflected in the "status_message" attribute of the "record" returned.

TBD: Additional Examples and Usage