Modifications

Sauter à la navigation Sauter à la recherche
733 octets ajoutés ,  7 janvier 2015 à 07:39
Ligne 26 : Ligne 26 :  
== Appel d'API ==
 
== Appel d'API ==
 
You can now make a '''GET''' request, even with your browser, to read the sensor at any time. The API endpoint is '''/v1/devices/{DEVICE_ID}/{VARIABLE}''' and as always, you have to include your access token.
 
You can now make a '''GET''' request, even with your browser, to read the sensor at any time. The API endpoint is '''/v1/devices/{DEVICE_ID}/{VARIABLE}''' and as always, you have to include your access token.
 +
 +
<nowiki># EXAMPLE REQUEST IN TERMINAL
 +
# Core ID is 0123456789abcdef01234567
 +
# Your access token is 1234123412341234123412341234123412341234
 +
curl "https://api.spark.io/v1/devices/0123456789abcdef01234567/temperature?access_token=1234123412341234123412341234123412341234"</nowiki>
 +
 +
And the response contains a result like this:
 +
 +
<nowiki>// EXAMPLE RESPONSE
 +
{
 +
  "cmd": "VarReturn",
 +
  "name": "temperature",
 +
  "result": 42,
 +
  "coreInfo": {
 +
    "last_app": "",
 +
    "last_heard": "2014-08-22T22:33:25.407Z",
 +
    "connected": true,
 +
    "deviceID": "53ff6c065075535119511687"
 +
  }</nowiki>
 +
 +
== Longueur des variables ==
 +
 +
Variable names {{underline|are truncated after the 12th character}}: temperature_sensor is accessible as temperature_
    
{{Spark.IO-Could-API-TRAILER}}
 
{{Spark.IO-Could-API-TRAILER}}
29 917

modifications

Menu de navigation