Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn installTo deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deployRefer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-android-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>Add this dependency to your project's build file:
compile "io.swagger:swagger-android-client:1.0.0"At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/swagger-android-client-1.0.0.jar
- target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import io.swagger.client.api.AuthorizationApi;
public class AuthorizationApiExample {
public static void main(String[] args) {
AuthorizationApi apiInstance = new AuthorizationApi();
String aPIKey = "aPIKey_example"; // String | Your Switch API Key.
String signature = "signature_example"; // String | Signature parameter is generated as md5(APISecret + ExpireTimestamp) format.
Long expire = 789L; // Long | Expire parameter, token's expire date and time information must be proper to ISO 8601 standarts and Unix Time format with msec information.
try {
String result = apiInstance.tokenGet(aPIKey, signature, expire);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthorizationApi#tokenGet");
e.printStackTrace();
}
}
}All URIs are relative to http://tr02.switchapi.com/
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AuthorizationApi | tokenGet | GET /Token | Generate Access Token |
| DBOperationsApi | addPost | POST /Add | Add is used for adding a data object to the list created at Switch DB. |
| DBOperationsApi | listPost | POST /List | It's used for listing a data added before. |
| DBOperationsApi | setDelete | DELETE /Set | It's used for deleting a data added before at Switch DB. |
| DBOperationsApi | setPost | POST /Set | It's used for updating a data object that is already added to Switch DB. |
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.
- Mert Sarac - Initial work