evrythng-java-sdk
The evrythng-java-sdk
SDK allows easy integration of the EVRYTHNG Platform into Java applications. There are functions available for most API operations, and enabled manipulation of Platform resources in a buildable, type-safe manner.
__
Installation
Add the evrythng-java-sdk
to either a Maven or Gradle project as required (where X.Y
is the latest version available on the Releases page of the GitHub repository).
Maven
<dependency>
<groupId>com.evrythng</groupId>
<artifactId>evrythng-java-wrapper</artifactId>
<version>X.Y</version>
<scope>compile</scope>
</dependency>
Gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.evrythng', name: 'evrythng-java-wrapper', version: 'X.Y'
}
Setup
Much like the evrythng.js
SDK, operations are performed using an object representing the authorizing API key. Here, an ApiManager
object must first be initialized using the appropriate API key.
For example, to authenticate as an Operator or application:
final ApiManager operator = new ApiManager("$OPERATOR_API_KEY");
final ApiManager application = new ApiManager("$APPLICATION_API_KEY");
An example of using the ApiManager
object to read all projects in an account:
final List<Project> projectList = operator.projectService().projectsReader().execute();
for(Project project : projectList) {
System.out.println(project.getName());
}
Android Support
The EVRYTHNG Java SDK can be used with the Android SDK to connect to the
Platform from within Android apps. However, there is a small caveat to avoid
conflicting with certain built-in Android libraries:
To successfully build your Android app with the EVRYTHNG Java SDK, add the
following object to the android
object in your app.gradle
file:
packagingOptions {
exclude 'META-INF/LICENSE'
}
Note
Excluding the LICENSE file can affect your ability to distribute the app.
Function Reference
The functions listed below are the most useful for typical implementations. Each is accessed from an instance of ApiManager
and must be launched using a final execute()
method in the chain.
For more advanced users, more functions are available upon inspection through IDE completion features.
In each case (...)
denotes various parameters are required or accepted for that function call.
Actions and Action Types
.actionService().actionTypeCreator(...); // Create an action type
.actionService().actionTypesReader(); // Read all action types
.actionService().actionTypeUpdater(...); // Update an action type
.actionService().actionTypeDeleter(...); // Delete an action type
.actionService().actionCreator(...); // Create an action
.actionService().actionReader(...); // Read an action
.actionService().iterator(); // Read all actions
.actionService().actionDeleter(...); // Delete an action
Applications
.applicationService().applicationCreator(...); // Create an application
.applicationService().applicationReader(...); // Read an application
.applicationService().applicationsReader(...); // Read all applications
.applicationService().applicationUpdater(...); // Update an application
.applicationService().applicationDeleter(...); // Delete an application
.applicationService().oauthClientCreator(...); // Create OAuth client
.applicationService().oauthClientReader(...); // Read an OAuth client
.applicationService().oauthClientUpdater(...); // Update an OAuth client
.applicationService().oauthClientDeleter(...); // Delete an OAuth client
Authentication (Devices and Application Users)
.authService().thngRegistrator(...); // Create Thng's Device API Key
.authService().thngRegistrationReader(...); // Read Thng's Device API Key
.authService().thngRegistrationDeleter(...); // Delete Thng's Device API Key
.authService().evrythngUserCreator(...); // Create an Application User
.authService().evrythngUserValidator(...); // Activate Application User
.authService().evrythngUserAuthenticator(...); // Log an Application User in
.authService().authLogouter().apiKey(...); // Log an Application User out
Batches
.batchService().batchCreator(...); // Create a batch
.batchService().batchReader(...); // Read a batch
.batchService().batchesReader(); // Read all batches
.batchService().batchUpdater(...); // Update a batch
.batchService().batchDeleter(...); // Delete a batch
.batchService().taskCreator(...); // Create a task
.batchService().taskReader(...); // Read a task
.batchService().tasksReader(); // Read all tasks
.batchService().logsReader(...); // Read task logs
Collections
.collectionService().collectionCreator(...); // Create a collection
.collectionService().collectionReader(...); // Read a collection
.collectionService().collectionsReader(); // Read all collections
.collectionService().collectionUpdater(...); // Update a collection
.collectionService().collectionDeleter(...); // Delete a collection
.collectionService().actionCreator(...); // Create a collection action
.collectionService().actionReader(...); // Read a collection action
.collectionService().actionsReader(); // Read all collection actions
.collectionService().thngsAdder(...); // Add Thngs to a collection
.collectionService().thngAdder(...); // Add a Thng to a collection
.collectionService().thngsReader(...); // Read Thngs in a collection
.collectionService().thngsRemover(...); // Remove Thngs from a collection
.collectionService().thngRemover(...); // Remove a Thng from a collection
.collectionService().childrenCollectionsAdder(...); // Add collections to a collection
.collectionService().childCollectionAdder(...); // Add a collection to a collection
.collectionService().childrenCollectionsReader(...); // Read collections in a collection
.collectionService().childrenCollectionsRemover(...); // Remove collections from a collection
.collectionService().childCollectionRemover(...); // Remove a collection from a collection
Files
.filesService().fileCreator(...); // Create a file
.filesService().fileReader(...); // Read a file
.filesService().filesReader(); // Read all files
.filesService().fileDeleter(...); // Delete a file
Identifier Recognition
.scanThngService().recognitionCreator(...); // Scan an image for identifiers
Places
.placeService().placeCreator(...); // Create a place
.placeService().placeReader(...); // Read a place
.placeService().placesReader(); // Read all places
.placeService().placeUpdater(...); // Update a place
.placeService().placeDeleter(...); // Delete a place
Products
.productService().productCreator(...); // Create a product
.productService().productReader(...); // Read a product
.productService().iterator(); // Read all products
.productService().productUpdater(...); // Update a product
.productService().productDeleter(...); // Delete a product
.productService().propertiesCreator(...); // Create product properties
.productService().propertiesReader(...); // Read product properties
.productService().propertiesIterator(...); // Read a product property
.productService().propertyUpdater(...); // Update a product property
.productService().propertiesDeleter(...); // Delete product properties
.productService().actionCreator(...); // Create a product action
.productService().actionsReader(...); // Read all product actions
.productService().actionReader(...); // Read a product action
Projects
.projectService().projectCreator(...); // Create a project
.projectService().projectReader(...); // Read a project
.projectService().projectsReader(); // Read all projects
.projectService().projectUpdater(...); // Update a project
.projectService().projectDeleter(...); // Delete a project
Redirector
.redirectorService().redirectorRulesReader(); // Read account Redirector
.redirectorService().redirectorRulesReader(...); // Read an application Redirector
.redirectorService().redirectorRulesUpdater(...); // Update account/application Redirector
Thngs
.thngService().thngCreator(...); // Create a Thng
.thngService().thngReader(...); // Read a Thng
.thngService().iterator(); // Read all Thngs
.thngService().thngUpdater(...); // Update a Thng
.thngService().thngDeleter(...); // Delete a Thng
.thngService().propertiesCreator(...); // Create Thng properties
.thngService().propertiesReader(...); // Read Thng properties
.thngService().propertiesIterator(...); // Read a Thng property
.thngService().propertyUpdater(...); // Update a Thng property
.thngService().propertyDeleter(...); // Delete a Thng property
.thngService().actionCreator(...); // Create a Thng action
.thngService().actionReader(...); // Read a Thng action
.thngService().actionsReader(); // Read all Thng actions
.thngService().locationUpdater(...); // Update Thng location
.thngService().locationReader(...); // Read Thng location
.thngService().locationDeleter(...); // Delete Thng location
Time
.timeService().timeReader(); // Read the current time
Updated almost 2 years ago