Skip to main content

Using the OpenAPI documentation

The BarentsWatch APIs are documented through OpenAPI pages available at https://www.barentswatch.no/bwapi/openapi/index.html. The pages list and describe all available API endpoints, including URLs, input parameters and return types.

Trying out endpoints

When browsing the OpenAPI pages, you can try making requests to any listed endpoint by expanding it and clicking "Try it out".

For the requests to work, you must first set up proper authorization. You may have to redo this whenever you reload the page. Otherwise, all endpoints will return 401 Unauthorized.

Authorizing using the bwopenapi client

This requires that you have a BarentsWatch user and are logged in at https://id.barentswatch.no/.

  1. On any OpenAPI page, click the "Authorize" button to view available authorizations.
  2. Scroll to the "OAuth2, authorizationCode with PKCE" authorization.
  3. Enter bwopenapi as the client_id.
  4. Leave client_secret empty.
  5. Check the "api" scope.
  6. Click "Authorize".
  7. If this is the first time doing this, you will be taken to https://id.barentswatch.no and prompted to grant API access to the client for OpenAPI documentation. Do so.

It should now say that you are authorized.

Authorizing using your own API client

This requires that you have a client set up with the "api" scope, as described at https://developer.barentswatch.no/docs/tutorial and https://developer.barentswatch.no/docs/appreg.

  1. On any OpenAPI page, click the "Authorize" button to view available authorizations.
  2. Scroll to the "OAuth2, clientCredentials" authorization.
  3. Enter your URL-encoded client ID as the client_id. Your normal client ID, with symbols like @ and :, will not work.
  4. Enter your client secret as the client_secret.
  5. Check the "api" scope.
  6. Click "Authorize".

It should now say that you are authorized.