This shows you the differences between two versions of the page.
| Last revision Both sides next revision | |||
|
oak:tutorials:particle-id-token [2016/03/19 19:16] jwhendy created |
oak:tutorials:particle-id-token [2016/03/19 19:22] jwhendy added example curl queries to test api with id and token |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| It may be handy to copy/paste these values somewhere locally for using with API calls (''curl'', ''python'', ''javascript'', etc.). Keep them safe, as they can be used maliciously. If you believe your token has been compromised, use the option to reset the token shown in the screenshot. | It may be handy to copy/paste these values somewhere locally for using with API calls (''curl'', ''python'', ''javascript'', etc.). Keep them safe, as they can be used maliciously. If you believe your token has been compromised, use the option to reset the token shown in the screenshot. | ||
| + | |||
| + | To test that the values are accurate, you can run these ''curl'' commands or simply paste the URL addresses into a browser (substituting the appropriate values for ''id_here'' and ''token_here''): | ||
| + | |||
| + | <code>$ curl https://api.particle.io/v1/devices?access_token=token_here</code> | ||
| + | |||
| + | Example response: | ||
| + | <code>[ | ||
| + | { | ||
| + | "id": "device_id_1", | ||
| + | "name": "device_name_1", | ||
| + | "last_app": null, | ||
| + | "last_ip_address": "xx.xxx.xx.xxx", | ||
| + | "last_heard": "2016-03-17T04:36:16.759Z", | ||
| + | "product_id": 82, | ||
| + | "connected": false, | ||
| + | "platform_id": 82, | ||
| + | "cellular": false, | ||
| + | "status": "normal" | ||
| + | }, | ||
| + | { | ||
| + | "id": "device_id_2", | ||
| + | "name": "device_name_2", | ||
| + | "last_app": null, | ||
| + | "last_ip_address": "xx.xxx.xx.xxx", | ||
| + | "last_heard": "2016-03-20T01:51:05.680Z", | ||
| + | "product_id": 82, | ||
| + | "connected": true, | ||
| + | "platform_id": 82, | ||
| + | "cellular": false, | ||
| + | "status": "normal" | ||
| + | } | ||
| + | ] | ||
| + | </code> | ||
| + | |||
| + | You can target a single device as well: | ||
| + | |||
| + | <code>$ curl "https://api.particle.io/v1/devices/id_here?access_token=token_here"</code> | ||
| + | |||
| + | Example response: | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "id": "device_id", | ||
| + | "name": "device_name", | ||
| + | "last_app": null, | ||
| + | "last_ip_address": "xx.xxx.xx.xxx", | ||
| + | "last_heard": "2016-03-20T01:51:05.680Z", | ||
| + | "product_id": 82, | ||
| + | "connected": true, | ||
| + | "platform_id": 82, | ||
| + | "cellular": false, | ||
| + | "status": "normal", | ||
| + | "variables": { | ||
| + | "x": "int32" | ||
| + | }, | ||
| + | "functions": [] | ||
| + | } | ||
| + | </code> | ||