Java/Kotlin
The Java/Kotlin SDK includes everything you need to get started: Method wrappers for all API endpoints, related domain/DTO classes, utility functions to handle dates, build search queries and generate OAuth PKCE challenges, and even an embedded Hawk module to handle the authentication protocol. It requires Java 8 or greater and has very few external dependencies.
In general, null
or Optional.empty()
means not specified in this SDK (like undefined
in JavaScript). To
explicitly erase a property, set it to Erasable.nil()
, which behaves more like null
in JSON and JavaScript. Erasable
is like the standard
Optional
, except that it can also represent null
.
Every enumerations (enum
) in the SDK contains an additional __
value, which is used if the server sends an unknown
value to the client. It maps to --
, which the server will never accept back. If this happens, make sure you're using
the latest version of the SDK, which always contains definitions for all possible enumerations. In practice, however,
this should rarely happen as you should always prefer the update…
(PATCH
) methods for modifying resources instead
of get…
/put…
(GET
/PUT
) pairs.
Adding the SDK to your project
The SDK is freely available and is published on the Central Repository. To use it, simply add it as a dependency to your project:
- Gradle
- Maven
implementation 'com.onslip:onslip-360-api:1.+'
<dependency>
<groupId>com.onslip</groupId>
<artifactId>onslip-360-api</artifactId>
<version>[1.0,2.0)</version>
</dependency>
Initialize the SDK
The SDK is initialized with a default request handler automatically and requires no further initialization (unless you want to plug in a custom request handler).
Create an API instance and make a request
Let's make the first call to the API server:
ResponseMetadata rmd = new ResponseMetadata();
API api = new API("https://test.onslip360.com/v1/", "<realm>", "key:<username>+<keyname>@<realm>", "<key>")
.appName("MyAwesomeClient/1.0")
.onResponseMetadata(rmd);
ClientInfo me = api.getClientInfo();
System.out.println("Me: " + me);
Don't yet have an API key? Log in to your Onslip 360 Backoffice account at https://test.onslip360.com, go to API Keys via the top-right user menu and create one!
When you are ready to go to production, simply change the API base URL from https://test.onslip360.com/v1/ to https://api.onslip360.com/v1/. You should also use OAuth to promote your work and make it easy for your customers to activate the integration.
Next steps
To learn more about the API, please refer to the Onslip 360 API User Guide.
Questions?
Send your questions to api@onslip.com.