Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Java Client API
Commits
da23386c
Commit
da23386c
authored
Oct 27, 2017
by
Matija Obreza
Browse files
Merge branch '6-release-1-2' into 'master'
Resolve "Release 1.2" Closes
#6
See merge request
!6
parents
21cde930
6c30fec0
Pipeline
#3033
passed with stage
in 22 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
0 → 100644
View file @
da23386c
# Genesys Client API changelog
## Release 1.2
October 2017
-
4aeb301 Logging
-
4c12425 Upgraded to scribe-java:4.2.0
README.md
View file @
da23386c
...
...
@@ -2,22 +2,25 @@
**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"
)
.
## Using the API client
### Initializing the client
## Initializing the client
```
java
GenesysClient
genesysClient
=
new
GenesysClient
();
// Set the Scribe OAuth API implementation
genesysClient
.
setGenesysApi
(
new
GenesysApi
());
// 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
);
String
baseUrl
=
"https://www.genesys-pgr.org"
;
String
clientId
=
"theClientId@genesys"
;
String
clientSecret
=
"thesecret"
;
String
callbackUrl
=
"oob"
;
String
scope
=
"write"
;
// write scope is required to manage data on Genesys
GenesysClient
genesysClient
=
new
GenesysClient
(
baseUrl
,
clientId
,
clientSecret
,
callbackUrl
,
scope
);
```
// 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
### Authentication
```
java
// Authenticate the user
String
authorizationUrl
=
genesysClient
.
getAuthorizationUrl
();
// The user must now open the authorizationUrl in the browser and approve the
// request on Genesys website. User gets the verifierCode.
String
verifierCode
=
null
;
// whatever user provides
genesysClient
.
authenticate
(
verifierCode
);
...
...
@@ -25,8 +28,24 @@ genesysClient.authenticate(verifierCode);
genesysClient
.
me
();
// Tokens are now accessible. The refreshToken must be **safely** stored for future use.
// genesysClient.getTokens().getAccessToken();
// genesysClient.getTokens().getRefreshToken();
```
### Re-using tokens
If you have existing tokens you can provide the access and refresh tokens when
initializing the client:
```
java
GenesysTokens
genesysTokens
=
new
GenesysTokens
();
genesysTokens
.
setAccessToken
(
"someaccesstoken"
);
genesysTokens
.
setRefreshToken
(
"somerefreshtoken"
);
genesysClient
.
setTokens
(
genesysTokens
);
```
## Using the API client
Updating data:
```
java
...
...
@@ -54,7 +73,7 @@ try {
<dependency>
<groupId>
org.genesys-pgr
</groupId>
<artifactId>
genesys-client-api
</artifactId>
<version>
1.
1
</version>
<version>
1.
2
</version>
</dependency>
```
...
...
@@ -64,7 +83,7 @@ Or for the development version:
<dependency>
<groupId>
org.genesys-pgr
</groupId>
<artifactId>
genesys-client-api
</artifactId>
<version>
1.
2
-SNAPSHOT
</version>
<version>
1.
3
-SNAPSHOT
</version>
</dependency>
```
...
...
@@ -77,6 +96,6 @@ Or for the development version:
### Your new project
-
Create a new Maven project in Eclipse, if starting from scratch
-
Add dependency on
`org.genesys-pgr:genesys-client-api`
art
e
fact to your
`pom.xml`
-
Add dependency on
`org.genesys-pgr:genesys-client-api`
art
i
fact to your
`pom.xml`
-
Create your integration project
-
Contact helpdesk@genesys-pgr.org for assistance if required
pom.xml
View file @
da23386c
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.genesys-pgr
</groupId>
<artifactId>
genesys-client-api
</artifactId>
<version>
1.
2
-SNAPSHOT
</version>
<version>
1.
3
-SNAPSHOT
</version>
<name>
Genesys API client library
</name>
<packaging>
jar
</packaging>
<url>
https://bitbucket.org/genesys2/genesys-client-api
</url>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment