Overview
This document describes how to use the network interface to manipulate server data. The request is followed by a restful-style http request
Request format
http://{domain} /{version}/{resource name}(/{URLID})?access-token={?}
For example :
http://openapi.tftiot.com/v2/devices/358688000000159?access-token=c9e9fc50-c65a-11e6-bc05-93eab5814c5a
Examples of use
In the web-side use jquery ajax to get token :
$.ajax({
type: 'POST',
url: "http://openapi.tftiot.com/v2/auth/action",
data: {
"getAccessToken": {
"account": "demo",
"password-md5": "demopasswd",
"client-type" : "web",
}
},
processData: false,
contentType: 'application/json',
dataType: "json",
success: function(data) {
console.log("token is:",data["access-token"])
console.log("keep time is:",data["keep-time"]+"s")
},
error: function(resp,result,desc) {
}
});
The print result is like:
Token is: c9ebf820-c65a-11e6-bc05-93eab5814c5a
Explanation:
If the time exceeds keeptime token are not used, token will be invalid.
Request type meaning
There are four types of resource operations:
GET
Get resources
POST
Create a new resource
PUT
Update resources
DELETE
Delete the resource
Explanation: But if it is action request, the request type is always POST