Commit fa0b6da3 authored by Matija Obreza's avatar Matija Obreza

README

parent df07a9ad
......@@ -4,14 +4,56 @@
**genesys-client-api** library aims to ease integration of your existing
accession management software in Java with [Genesys PGR portal](https://www.genesys-pgr.org "Visit Genesys PGR").
## How to use `genesys-client-api`
## Using the API client
### Initializing the client
GenesysClient genesysClient = new GenesysClient();
// Set server URL
genesysClient.setBaseUrl("https://www.genesys-pgr.org");
// Specify clientKey, secret and the callback URL as registered on the server
genesysClient.connect(clientKey, clientSecret, callbackUrl);
// Ask end user to navigate to Genesys server and authorize your access to their resources
String authorizationUrl = genesysClient.getAuthorizationUrl(GenesysClient.EMPTY_TOKEN);
// Open this URL in browser, login and allow us to access your resources and come back with the code
String verifierCode = null; // whatever user provides
genesysClient.authenticate(verifierCode);
// Test it with /me
genesysClient.me();
// Tokens are now accessible. The refreshToken must be **safely** stored for future use.
Updating data:
List<AccessionJson> accns=new ArrayList<AccessionJson>();
// In a loop, create, fill and add entries to the list
{
AccessionJson accn=new AccessionJson();
accns.add(accn);
}
// Once the appropriate batch size is reached
// (good size is 25 or 50 entries)
// send to server
try {
genesysClient.updateAccessions(instCode, accns);
} catch (....) {
// handle exceptions
}
## How to reference `genesys-client-api`
The genesys-client-api snapshots are published on [OSSRH](https://oss.sonatype.org/content/groups/public).
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>genesys-client-api</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</dependency>
### Your copy of the library
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment