Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 2.03 KB

README.md

File metadata and controls

66 lines (48 loc) · 2.03 KB

GBIF Registry WS Client

This project provides the WS client to the registry web services. It implements the GBIF Registry API.

Internally the module uses OpenFeign and Spring Cloud OpenFeign.

Common classes and configuration for clients can be found in the project gbif-common-ws.

The registry-ws client can be configured in the following ways:

Read-only mode

Example:

// set this to the web service URL.  It might be localhost:8080 for local development
String wsUrl = "http://api.gbif.org/v1/";
ClientBuilder clientBuilder = new ClientBuilder();
clientBuilder.withUrl(wsUrl);
DatasetServcie datasetClient = clientBuilder.build(DatasetClient.class);

Read-write mode

This includes authentication functionality. There are two ways: use simple user basic authentication or GBIF app authentication.

Using simple user basic authentication

// set this to the web service URL.  It might be localhost:8080 for local development
String wsUrl = "http://api.gbif.org/v1/";
String password = "password";
String username = "username";
ClientBuilder clientBuilder = new ClientBuilder();
clientBuilder
  .withUrl(wsUrl)
  .withCredentials(username, password);
DatasetServcie datasetClient = clientBuilder.build(DatasetClient.class);

Make sure you are using right properties wsUrl, username and passowrd.

Using GBIF app authentication

// set this to the web service URL.  It might be localhost:8080 for local development
String wsUrl = "http://api.gbif.org/v1/";
String appKey = "app.key";
String secretKey = "secret-key";
String username = "username";
ClientBuilder clientBuilder = new ClientBuilder();
clientBuilder
  .withUrl(wsUrl)
  .withAppKeyCredentials(username, appKey, secretKey);
DatasetServcie datasetClient = clientBuilder.build(DatasetClient.class);

Make sure you are using right properties wsUrl, username, appKey and secretKey.

Parent