Manual

Step 1: Create my application

In order to run the development environment normally, you need to create an application and obtain the corresponding [application ID], [App security key] and [Message service address], the specific steps are as follows:

1.Click to enter Feitian Intelligent IOT platform login page, log in to Feitian Intelligent IOT platform.

2.In the list on the left side of the management platform, click [Add Application] to jump to the add application interface to add an application.

3.Enter [application name], application description (optional), click the [Save] button, the page jumps to the application list to view the newly added application’s [application ID] [App security key] [Message service address] and other key information , These parameters are needed during API initialization.

Step 2: Download the Java SDK, please click the download icon below:

Step 3: Initialization

Request interface:public static void init(String serverUrl,     String appKey,    String appSecret)

Interface function: To integrate with the Feitian Intelligent IoT platform through Feitian’s Java SDK, the initialization interface needs to be called first, and this interface only needs to be called once.

parameter name Parameter Description
serverUrl Application service address
appKey Application ID
appSecret App security key
parameter name Parameter Description
nothing nothing
														  
															
															import com.ft.iot.sdk.CustomerApi;
																
															
															                                                   
															public static void main(String[] args) {
																String serverUrl = "<Your serverUrl>";
																String appKey = "<Your appkey>";
																String appSecret = "<Your appsecret>";
																CustomerApi.init(serverUrl, appKey, appSecret);
															}
															  
														  
														
Step 4: Integrate the interfaces you need

After the initialization is complete, you can perform interface integration according to your business needs, please refer to the SDK interface for details

SDK initialization

Request interface: public static void init(String serverUrl,     String appKey,    String appSecret)

Interface function: To integrate with the Feitian Intelligent IoT platform through Feitian’s Java SDK, the initialization interface needs to be called first, and this interface only needs to be called once.

parameter name Parameter Description
serverUrl Application service address
appKey Application ID
appSecret App security key
parameter name Parameter Description
nothing nothing
										  
											
											import com.ft.iot.sdk.CustomerApi;
												
											
											                                                   
											public static void main(String[] args) {
												String serverUrl = "<Your serverUrl>";
												String appKey = "<Your appkey>";
												String appSecret = "<Your appsecret>";
												CustomerApi.init(serverUrl, appKey, appSecret);
											}
											  
										  
										

Device binding

Request interface: public static string bindDevice(String deviceSN,    String paycode)

Interface function: bind the terminal device and the merchant's QR code plate. Upload the device number and QR code plate identification to the message service platform. After the verification is passed, bind the device and code plate.

parameter name Parameter Description
deviceSN device ID
paycode Money collection code (the content of the QR code of the money collection code)
parameter name Parameter Description
code Return response code
msg Result description
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String deviceSN = "<Your device number>";
															String paycode = "<Your payment code>";
															CustomerApi.bindDevice(deviceSN, paycode);
														}
														  
													  
													

Message push (using device code)

Request interface:public static String push(String deviceSN,    int message,    int pushTemplate)

Interface function: Push messages to specified devices.

parameter name Parameter Description
deviceSN Device number, you can specify the device number to push messages to the device
message Broadcast amount, int type, unit: cent
pushTemplate Voice template (5 Alipay; 6 WeChat; 7 Scan (default); 8 UnionPay)
parameter name Parameter Description
code Return response code
msg Result description
nonce The nonce when requested, bring it back as it is
pushsn Message serial number
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String deviceSN = "<Your device number>";
															Integer message = "<Announced amount>";
															Integer pushTemplate = "<Your template number>";
															CustomerApi.push(deviceSN, message, pushTemplate);
														}
														  
													  
													

Message push (using the code plate number)

Request interface:public static String pushByPaycode(String paycode,    int message,      int pushTemplate)

Interface function: push voice messages to specified devices.

parameter name Parameter Description
paycode Collection code, specify the collection code, and push messages to the bound device
message Broadcast amount, int type, unit: cent
pushTemplate Voice template (5 Alipay; 6 WeChat; 7 Scan (default); 8 UnionPay)
parameter name Parameter Description
code Return response code
msg Result description
pushsn Message serial number
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String paycode = "<Your payment code>";
															Integer message = "<Announced amount>";
															Integer pushTemplate = "<Your message template number>";
															CustomerApi.pushByPaycode(paycode, message, pushTemplate);
														}
														  
													  
													

Get code plate binding device

Request interface: public static String getBindDevice(String paycode)

Interface function: Obtain the device information bound to the code plate.

parameter name Parameter Description
paycode Money collection code (the content of the QR code of the money collection code)
parameter name Parameter Description
code Return response code
msg Result description
deviceSN device ID
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
parameter name Parameter Description
code Return response code
msg Result description
pushsn Message serial number
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String paycode = "<Your payment code>";
															CustomerApi.getBindDevice(paycode);			
														}
														  
													  
													

Get device information

Request interface:public static String getDeviceInfo(String deviceSN)

Interface function: check the information of a specified device.

parameter name Parameter Description
deviceSN device ID
parameter name Parameter Description
code Return response code
msg Result description
status The binding status of the device (0 is not bound, 1 is bound)
state Device status (0 normal, 1 disabled)
is_online Whether online (0 online, 1 offline)
version current version
last_online_time Last online time
last_offline_time Last offline time
location_info Device location information, for example: {"descp","Xueqing Road, Haidian District, Beijing, near Huizhi Building"}}
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String deviceSN = "<Your device number>";
															CustomerApi.getDeviceInfo(deviceSN);			
														}
														  
													  
													

Unbind device

Request interface:public static String unbindDevice(String deviceSN)

Interface function: release the binding relationship between the terminal device and the QR code plate.

parameter name Parameter Description
deviceSN device ID
parameter name Parameter Description
code Return response code
msg Result description
nonce The nonce when requested, bring it back as it is
sign Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature
													  
														
														import com.ft.iot.sdk.CustomerApi;
															
														
														                                                   
														public static void main(String[] args) {
															String deviceSN = "<Your device number>";
															CustomerApi.unbindDevice(deviceSN);			
														}