ARTIK Cloud Java/Android SDK
This SDK helps you connect your Java or Android apps to ARTIK Cloud. The SDK exposes a number of methods to easily execute REST, WebSockets, and MQTT API calls to ARTIK Cloud.
Prerequisites
- Maven or Maven Integration for Eclipse
- JavaSE 1.7 or above
The SDK was developed with Maven and tested with Android 4.4.2. Building Maven will fetch the correct libraries. You might be able to build the SDK in a different environment and we would be happy to hear about your (success) stories.
Installation
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Maven users
Add this dependency to your project's POM:
<dependency>
<groupId>cloud.artik</groupId>
<artifactId>artikcloud-java</artifactId>
<version>2.2.2</version>
<scope>compile</scope>
</dependency>
Gradle users
Add this dependency to your project's build file:
compile "cloud.artik:artikcloud-java:2.2.2"
Others
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/artikcloud-java-2.2.2.jar
- target/lib/*.jar
Getting Started
Please follow the installation instruction and execute the following Java code:
import cloud.artik.client.*;
import cloud.artik.client.auth.*;
import cloud.artik.model.*;
import cloud.artik.api.DeviceTypesApi;
import java.io.File;
import java.util.*;
public class DeviceTypesApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: artikcloud_oauth
OAuth artikcloud_oauth = (OAuth) defaultClient.getAuthentication("artikcloud_oauth");
artikcloud_oauth.setAccessToken("YOUR ACCESS TOKEN");
DeviceTypesApi apiInstance = new DeviceTypesApi();
String deviceTypeId = "deviceTypeId_example"; // String | deviceTypeId
try {
ManifestVersionsEnvelope result = apiInstance.getAvailableManifestVersions(deviceTypeId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceTypesApi#getAvailableManifestVersions");
e.printStackTrace();
}
}
}
Documentation for REST API Endpoints
All URIs are relative to https://api.artik.cloud/v1.1
Class | Method | HTTP request | Description |
---|---|---|---|
DeviceTypesApi | getAvailableManifestVersions | GET /devicetypes/{deviceTypeId}/availablemanifestversions | Get Available Manifest Versions |
DeviceTypesApi | getDeviceType | GET /devicetypes/{deviceTypeId} | Get Device Type |
DeviceTypesApi | getDeviceTypes | GET /devicetypes | Get Device Types |
DeviceTypesApi | getDeviceTypesByApplication | GET /applications/{appId}/devicetypes | Get Device Types by Application |
DeviceTypesApi | getLatestManifestProperties | GET /devicetypes/{deviceTypeId}/manifests/latest/properties | Get Latest Manifest Properties |
DeviceTypesApi | getManifestProperties | GET /devicetypes/{deviceTypeId}/manifests/{version}/properties | Get manifest properties |
DevicesApi | addDevice | POST /devices | Add Device |
DevicesApi | deleteDevice | DELETE /devices/{deviceId} | Delete Device |
DevicesApi | deleteDeviceToken | DELETE /devices/{deviceId}/tokens | Delete Device Token |
DevicesApi | getDevice | GET /devices/{deviceId} | Get Device |
DevicesApi | getDevicePresence | GET /devices/{deviceId}/presence | Get device presence information |
DevicesApi | getDeviceToken | GET /devices/{deviceId}/tokens | Get Device Token |
DevicesApi | updateDevice | PUT /devices/{deviceId} | Update Device |
DevicesApi | updateDeviceToken | PUT /devices/{deviceId}/tokens | Update Device Token |
DevicesManagementApi | createTasks | POST /devicemgmt/tasks | Create a new task for one or more devices |
DevicesManagementApi | deleteServerProperties | DELETE /devicemgmt/devices/{did}/serverproperties | Deletes a device's properties. |
DevicesManagementApi | getAllByDid | GET /devicemgmt/devices/{did}/tasks | Returns the list of tasks for a particular device id with optional status filter. |
DevicesManagementApi | getDeviceTypesInfo | GET /devicemgmt/devicetypes/{dtid} | Read a device type device management information. |
DevicesManagementApi | getManifestProperties | GET /devicemgmt/devicetypes/{dtid}/manifest/properties | Get a device type's device management manifest properties |
DevicesManagementApi | getProperties | GET /devicemgmt/devices/{did}/properties | Read a device's properties. |
DevicesManagementApi | getStatuses | GET /devicemgmt/tasks/{tid}/statuses | Returns the details and status of a task id and the individual statuses of each device id in the list. |
DevicesManagementApi | getStatusesHistory | GET /devicemgmt/tasks/{tid}/statuses/history | Returns the history of the status changes for a specific task id, or for a specific device id in that task. |
DevicesManagementApi | getTaskByID | GET /devicemgmt/tasks/{tid} | Returns the details and global status of a specific task id. |
DevicesManagementApi | getTasks | GET /devicemgmt/tasks | Returns the all the tasks for a device type. |
DevicesManagementApi | queryProperties | GET /devicemgmt/devices/properties | Query device properties across devices. |
DevicesManagementApi | updateDeviceTypesInfo | PUT /devicemgmt/devicetypes/{dtid} | Updates a device type information |
DevicesManagementApi | updateServerProperties | POST /devicemgmt/devices/{did}/serverproperties | Updates a device's server properties. |
DevicesManagementApi | updateTask | PUT /devicemgmt/tasks/{tid} | Updates a task for all devices - For now just allows changing the state to cancelled. |
DevicesManagementApi | updateTaskForDevice | PUT /devicemgmt/tasks/{tid}/devices/{did} | Updates a task for a specific device - For now just allows changing the state to cancelled. |
DevicesSharesApi | createShareForDevice | POST /devices/{deviceId}/shares | Share a device |
DevicesSharesApi | deleteSharingForDevice | DELETE /devices/{deviceId}/shares/{shareId} | Delete specific share of the given device id |
DevicesSharesApi | getAllSharesForDevice | GET /devices/{deviceId}/shares | List all shares for the given device id |
DevicesSharesApi | getSharingForDevice | GET /devices/{deviceId}/shares/{shareId} | Get specific share of the given device id |
DevicesStatusApi | getDeviceStatus | GET /devices/{deviceId}/status | Get Device Status |
DevicesStatusApi | getDevicesStatus | GET /devices/status | Get Devices Status |
DevicesStatusApi | putDeviceStatus | PUT /devices/{deviceId}/status | Update Device Status |
ExportApi | exportRequest | POST /messages/export | Create Export Request |
ExportApi | getExportHistory | GET /messages/export/history | Get Export History |
ExportApi | getExportResult | GET /messages/export/{exportId}/result | Get Export Result |
ExportApi | getExportStatus | GET /messages/export/{exportId}/status | Check Export Status |
MessagesApi | getAggregatesHistogram | GET /messages/analytics/histogram | Get Normalized Message Histogram |
MessagesApi | getFieldPresence | GET /messages/presence | Get normalized message presence |
MessagesApi | getLastNormalizedMessages | GET /messages/last | Get Last Normalized Message |
MessagesApi | getMessageAggregates | GET /messages/analytics/aggregates | Get Normalized Message Aggregates |
MessagesApi | getMessageSnapshots | GET /messages/snapshots | Get Message Snapshots |
MessagesApi | getNormalizedActions | GET /actions | Get Normalized Actions |
MessagesApi | getNormalizedMessages | GET /messages | Get Normalized Messages |
MessagesApi | sendActions | POST /actions | Send Actions |
MessagesApi | sendMessage | POST /messages | Send Message |
MonetizationApi | createPricingTiers | POST /pricing/devicetypes/{dtid}/pricingtiers | Define devicetype's pricing tiers. |
MonetizationApi | getPricingTiers | GET /pricing/devices/{did}/pricingtiers | Get a device's pricing tiers |
MonetizationApi | getThePricingTiers | GET /pricing/devicetypes/{dtid}/pricingtiers | Get devicetype's pricing tiers. |
MonetizationApi | getUpgradePath | GET /pricing/devices/{did}/revenueshare/upgradepath | Get upgrade path |
MonetizationApi | setPricingTier | PUT /pricing/devices/{did}/pricingtiers | Set a device's pricing tier |
RegistrationsApi | confirmUser | PUT /devices/registrations/pin | Confirm User |
RegistrationsApi | getRequestStatusForUser | GET /devices/registrations/{requestId}/status | Get Request Status For User |
RegistrationsApi | unregisterDevice | DELETE /devices/{deviceId}/registrations | Unregister Device |
RulesApi | createRule | POST /rules | Create Rule |
RulesApi | deleteRule | DELETE /rules/{ruleId} | Delete Rule |
RulesApi | getRule | GET /rules/{ruleId} | Get Rule |
RulesApi | updateRule | PUT /rules/{ruleId} | Update Rule |
SubscriptionsApi | createSubscription | POST /subscriptions | Create Subscription |
SubscriptionsApi | deleteSubscription | DELETE /subscriptions/{subId} | Delete Subscription |
SubscriptionsApi | getAllSubscriptions | GET /subscriptions | Get All Subscriptions |
SubscriptionsApi | getMessages | GET /notifications/{notifId}/messages | Get Messages |
SubscriptionsApi | getSubscription | GET /subscriptions/{subId} | Get Subscription |
SubscriptionsApi | validateSubscription | POST /subscriptions/{subId}/validate | Validate Subscription |
TagsApi | getTagCategories | GET /tags/categories | Get all categories |
TagsApi | getTagSuggestions | GET /tags/suggestions | Get tag suggestions |
TagsApi | getTagsByCategories | GET /tags | Get all tags of categories |
TokensApi | checkToken | POST /accounts/checkToken | Check Token |
TokensApi | refreshToken | POST /accounts/token | Refresh Token |
TokensApi | tokenInfo | GET /accounts/tokenInfo | Token Info |
UsersApi | createUserProperties | POST /users/{userId}/properties | Create User Application Properties |
UsersApi | deleteUserProperties | DELETE /users/{userId}/properties | Delete User Application Properties |
UsersApi | getSelf | GET /users/self | Get Current User Profile |
UsersApi | getUserDeviceTypes | GET /users/{userId}/devicetypes | Get User Device Types |
UsersApi | getUserDevices | GET /users/{userId}/devices | Get User Devices |
UsersApi | getUserProperties | GET /users/{userId}/properties | Get User application properties |
UsersApi | getUserRules | GET /users/{userId}/rules | Get User Rules |
UsersApi | listAllSharesForUser | GET /users/{userId}/shares | Get User shares |
UsersApi | updateUserProperties | PUT /users/{userId}/properties | Update User Application Properties |
WhitelistingApi | deleteVdid | DELETE /devicetypes/{dtid}/whitelist/{vdid} | Delete a vdid from the devicetype whitelist. |
WhitelistingApi | deleteWhitelistCertificate | DELETE /devicetypes/{dtid}/whitelist/certificates/{cid} | Delete a whitelist certificate associated with a devicetype. |
WhitelistingApi | enableWhitelist | PUT /devicetypes/:dtid/whitelist/enable | Enable or disble whitelist feature of a device type |
WhitelistingApi | getRejectedRowList | GET /devicetypes/{dtid}/whitelist/{uploadId}/rejectedRows | Get the list of rejected rows for an uploaded CSV file. |
WhitelistingApi | getUploadStatus | GET /devicetypes/{dtid}/whitelist/{uploadId}/status | Get the status of a uploaded CSV file. |
WhitelistingApi | getWhitelist | GET /devicetypes/{dtid}/whitelist | Get whitelisted vdids of a device type. |
WhitelistingApi | getWhitelistCertificate | GET /devicetypes/{dtid}/whitelist/certificates | Get whitelist certificate of device type. |
WhitelistingApi | getWhitelistStatus | GET /devicetypes/{dtid}/whitelist/status | Get the status of whitelist feature (enabled/disabled) of a device type. |
WhitelistingApi | uploadCSV | POST /devicetypes/{dtid}/whitelist | Upload a CSV file related to the Device Type. |
Documentation for Models
- AckEnvelope
- Acknowledgement
- Action
- ActionArray
- ActionDetails
- ActionDetailsArray
- ActionIn
- ActionOut
- Actions
- AggregateData
- AggregatesHistogramData
- AggregatesHistogramResponse
- AggregatesResponse
- AppProperties
- CertificateData
- CertificateEnvelope
- CertificateFields
- CertificateId
- CheckTokenMessage
- CheckTokenResponse
- ContactInfo
- Device
- DeviceArray
- DeviceEnvelope
- DevicePricingTier
- DevicePricingTierEnvelope
- DevicePricingTierRequest
- DevicePricingTiers
- DevicePricingTiersEnvelope
- DeviceRegCompleteRequest
- DeviceRegConfirmUserRequest
- DeviceRegConfirmUserResponse
- DeviceRegConfirmUserResponseEnvelope
- DeviceRegStatusResponse
- DeviceRegStatusResponseEnvelope
- DeviceShareInfo
- DeviceSharing
- DeviceSharingArray
- DeviceSharingEnvelope
- DeviceSharingId
- DeviceStatus
- DeviceStatusBatch
- DeviceStatusData
- DeviceStatusPut
- DeviceStatusPutData
- DeviceTask
- DeviceTaskUpdateRequest
- DeviceTaskUpdateResponse
- DeviceToken
- DeviceTokenEnvelope
- DeviceType
- DeviceTypeArray
- DeviceTypeEnvelope
- DeviceTypeInfo
- DeviceTypeInfoEnvelope
- DeviceTypePricingList
- DeviceTypePricingTier
- DeviceTypePricingTiersEnvelope
- DeviceTypeUpdateInput
- DeviceTypesEnvelope
- DeviceTypesInfo
- DeviceTypesInfoEnvelope
- DevicesEnvelope
- ErrorEnvelope
- EventFeedData
- ExportData
- ExportDataArray
- ExportHistoryResponse
- ExportNormalizedMessagesResponse
- ExportRequest
- ExportRequestData
- ExportRequestInfo
- ExportRequestResponse
- ExportResponse
- ExportStatusResponse
- FieldPath
- FieldPresence
- FieldPresenceEnvelope
- FieldsActions
- ManifestProperties
- ManifestPropertiesEnvelope
- ManifestVersions
- ManifestVersionsEnvelope
- Message
- MessageAction
- MessageID
- MessageIDEnvelope
- MessageIn
- MessageOut
- MetadataEnvelope
- MetadataPropertiesEnvelope
- MetadataQueryEnvelope
- NonEmptyString
- NormalizedAction
- NormalizedActionsEnvelope
- NormalizedMessage
- NormalizedMessagesEnvelope
- NotifMessage
- NotifMessageArray
- NotifMessagesResponse
- OutputRule
- PresenceEnvelope
- PresenceModel
- PropertiesEnvelope
- RefreshTokenResponse
- RegisterMessage
- RejectedCSVRow
- RejectedCSVRowsEnvelope
- RuleArray
- RuleCreationInfo
- RuleEnvelope
- RuleError
- RuleUpdateInfo
- RuleWarningOutput
- RulesEnvelope
- SnapshotResponse
- SnapshotResponses
- SnapshotsResponseEnvelope
- Subscription
- SubscriptionArray
- SubscriptionEnvelope
- SubscriptionInfo
- SubscriptionsEnvelope
- Tag
- TagArray
- TagsEnvelope
- Task
- TaskByDid
- TaskByDidList
- TaskByDidListEnvelope
- TaskEnvelope
- TaskHistory
- TaskHistoryList
- TaskList
- TaskListEnvelope
- TaskParameters
- TaskRequest
- TaskStatus
- TaskStatusCounts
- TaskStatuses
- TaskStatusesEnvelope
- TaskStatusesHistoryEnvelope
- TaskUpdateRequest
- TaskUpdateResponse
- TasksStatusCounts
- Tier
- Token
- TokenInfo
- TokenInfoSuccessResponse
- TokenRequest
- TokenResponse
- UnregisterDeviceResponse
- UnregisterDeviceResponseEnvelope
- UpdateParameters
- UpgradePath
- UpgradePathEnvelope
- UpgradePathUserToken
- UpgradePathUserTokenEnvelope
- UploadIdEnvelope
- UploadStatusEnvelope
- User
- UserEnvelope
- ValidationCallbackInfo
- ValidityPeriod
- WebSocketError
- Whitelist
- WhitelistEnvelope
- WhitelistResultEnvelope
Documentation for Authorization
Authentication schemes defined for the API:
artikcloud_oauth
- Type: OAuth
- Flow: implicit
- Authorizatoin URL: https://accounts.artik.cloud/authorize
- Scopes:
- read:artikcloud: Read from ARTIK Cloud
- write:artikcloud: Write from ARTIK Cloud
Documentation for MQTT
Coding Recommendation
For REST API calls, it's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issue.
Usage
Peek into tests for examples about how to use the SDK.
In addition, you can look at our tutorial and sample applications. These will give you a good overview of what you can do and how to do it. Read more about it at https://developer.artik.cloud/documentation/tutorials/code-samples/
More about ARTIK Cloud
If you are not familiar with ARTIK Cloud, we have extensive documentation at https://developer.artik.cloud/documentation
The full ARTIK Cloud API specification can be found at https://developer.artik.cloud/documentation/api-reference/
Check out advanced sample applications at https://developer.artik.cloud/documentation/tutorials/
To create and manage your services and devices on ARTIK Cloud, create an account at https://developer.artik.cloud
Also see the ARTIK Cloud blog for tutorials, updates, and more: http://artik.io/blog/cloud
License and Copyright
Licensed under the Apache License. See LICENSE.
Copyright (c) 2017 Samsung Electronics Co., Ltd.