110 likes | 250 Views
Catalog REST for data providers. ECHO Technical Interchange 04/30/13 3:15pm EST Doug Newman. Rationale. Troubleshooting your data issues Managing your data Surgical fixes (REST providers only) On a provider, dataset and granule level. Tools to follow along. Firefox Rest Client add-on
E N D
Catalog RESTfor data providers ECHO Technical Interchange 04/30/13 3:15pm EST Doug Newman
Rationale • Troubleshooting your data issues • Managing your data • Surgical fixes (REST providers only) • On a provider, dataset and granule level
Tools to follow along • Firefox Rest Client add-on http://restclient.net/ • Chrome Advanced Rest Client add-on https://chrome.google.com/webstore/detail/advanced-rest-client • IE – on your own • Command line curl
Things you need to know • HTTP • REST (GET, POST, PUT, DELETE) • XML • ECHO ingest
The key to the kingdom (tokens) Request: • POST https://api.echo.nasa.gov/echo-rest/tokens Body: <token> <username>ops urs username</username> <password>ops urs password</password> <client_id>your id</client_id> <user_ip_address>your IP address</user_ip_address> </token> Headers: • Content-Type: application/xml Response: <?xml version="1.0" encoding="UTF-8"?> <token> <id>XXDD5E8D-039C-6386-FF50-D8DC24009051</id> <username>ops urs username</username> <client_id>your id</client_id> <user_ip_address>your IP address</user_ip_address> </token>
Your provider Requests: • GET https://api.echo.nasa.gov/catalog-rest/providers/<provider_id> • PUT https://api.echo.nasa.gov/catalog-rest/providers/<provider_id> Headers: • Accept: application/xml • Content-Type: application/xml • Echo-Token: your token value
Your datasets Requests: • GET https://api.echo.nasa.gov/catalog-rest/providers/<provider id>/datasets/<dataset id> • PUT https://api.echo.nasa.gov/catalog-rest/providers/<provider id>/datasets/<dataset id> A note about encoding: you may have to url-encode your dataset id, etc (not with FF Rest Client) Headers: • Accept: application/xml • Content-Type: application/xml • Echo-Token: your token value
Your granules Requests: • GET https://api.echo.nasa.gov/catalog-rest/providers/<provider id>/granules/<granule id> • PUT https://api.echo.nasa.gov/catalog-rest/providers/<provider id>/granules/<granule id> • DELETE https://api.echo.nasa.gov/catalog-rest/providers/<provider id>/granules/<granule id> A note about encoding: you may have to url-encode your granule id etc (not with FF Rest Client) Headers: • Accept: application/xml • Content-Type: application/xml • Echo-Token: your token value
Visibility to your users https://api.echo.nasa.gov/catalog-rest/echo_catalog/ • datasets.xml • datasets.xml?dataset_id=my_dataset_id • datasets.xml?provider=my_provider • datasets.xml?provider=my_provider&page_size=20&page_num=2 • granules.xml • granules.xml?granule_ur=my_granule_ur • granules.xml?dataset_id=my_dataset_id • granules.xml?dataset_id=my_dataset_id&page_size=20&page_num=2 https://api.echo.nasa.gov/catalog-rest/catalog-docs/index.html
With great power… “I can do that? ” YES