Get started - npolar/api.npolar.no GitHub Wiki

Background

The Norwegian Polar Data Centre API is a service that lets users retrieve data from the Norwegian Polar Institute (NPI) by HTML/JSON/CSV over HTTP. The API uses the same backend as the NPIs databases. Most of the data is publicly available under the [CC 3.0 licence] (https://creativecommons.org/licenses/by/3.0/). Some of the newer data is currently only available upon request, for the data their API is not publicly available.

How to get started

Where to find data

We recommend looking for research data in our dataset database. Here you can find a short description of the data.

The database is also available through the dataset API.

How to get data

Many of NPIs datasets can be found in the API.

where "/name" in the end of the link represents a data collection, f.ex. "https://api.npolar.no/oceanography" contains oceanography data.

To view the full dataset in HTML: "https://api.npolar.no/ name /?q=" f.ex. "https://api.npolar.no/oceanography/?q="

Use HTTP GET to get JSON data: "https://api.npolar.no/ name /?q=&format=json" f.ex. "https://api.npolar.no/oceanography/?q=&format=json"

Content-type is application/json.

Use HTTP GET to get CSV data: https://api.npolar.no/ name /?q=&format=csv f.ex. https://api.npolar.no/oceanography/?q=&format=csv

Content-type is text/csv

HTTP examples using curl:

Use curl to get the vessel dataset and store it in local file named "vessel": curl -XGET "https://api.npolar.no/vessel/?q=&format=json" -H "Content-Type=application/json" -k >> vessel

Use curl to get the expedition dataset and print it to standard output, usually screen display: curl -XGET "https://api.npolar.no/expedition/?q=&format=csv" -H "Content-Type=text/csv"

Use curl to access to Marine Mammal Sightings returning a json document to a file called sighting: curl -XGET "https://api.npolar.no/inventory/?q=&format=json" -H "Content-Type: application/json"
-u your-login-name –k >> sighting

Getting dataset subsets

For filtering, faceting, aggregations see https://github.com/npolar/icelastic

Examples:

Polar bear incidents from Isbjørnhamna: http://api.npolar.no/polar-bear/incident/?q=&filter-location.name=Isbj%C3%B8rnhamna

Polar bear incidents sorted on location name: http://api.npolar.no/polar-bear/incident/?q=&sort=location.name

Polar bear incidents filtered on status incomplete: http://api.npolar.no/polar-bear/incident/?q=&filter-status=incomplete

Polar bear inscidents filtered from year 2007-2008 in csv format: http://api.npolar.no/polar-bear/incident/?q=&filter-incident.datetime=2002-01-01T00:00:00Z..2003-01-01T00:00:00Z&format=csv

Error handling

If an error occurs, you will receive an HTTP error status code from the API corresponding to the HTTP protocol error messages:

200 OK
400 "Missing or blank request id, cannot handle request" - Bad request
400 "Document with no body" - Bad request
403 "You are not allowed to access the resource or your credentials are wrong" -Forbidden.
405 "The following HTTP methods are allowed"- Method Not Allowed.
406 "Unacceptable format, this API endpoint supports the following formats" - Not Acceptable
415 "Unsupported media type. Acceptable POST/PUT media types are" - Unsupported Media Type
422 Unprocessable Entity (WebDAV; RFC 4918)
500 "Polar bears ate your request" - Internal Server Error
501 "No storage set for API endpoint, cannot handle request" - Not Implemented

Further explanations can be found at https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Encoding

The API supports UTF-8 charset.

⚠️ **GitHub.com Fallback** ⚠️