This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
oak:tutorials:particle-id-token [2016/03/19 19:22] jwhendy added example curl queries to test api with id and token |
oak:tutorials:particle-id-token [2016/03/22 21:56] jwhendy |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Oak: Particle API basics ===== | ||
| + | |||
| To access the Particle API (such as using ''Particle.variable()'', ''Particle.publish()'', ''Particle.function()'' et al.), you will need your device ID and an access token. This short tutorial points out where to obtain those values. | To access the Particle API (such as using ''Particle.variable()'', ''Particle.publish()'', ''Particle.function()'' et al.), you will need your device ID and an access token. This short tutorial points out where to obtain those values. | ||
| + | |||
| + | === Device ID === | ||
| Go to [[https://build.particle.io/|build.particle.io]] and click the icon second from the bottom on the left hand side. It will bring up a list of your registered devices and corresponding device IDs. The icon to click and location of the first device's ID are shown outlined in red: | Go to [[https://build.particle.io/|build.particle.io]] and click the icon second from the bottom on the left hand side. It will bring up a list of your registered devices and corresponding device IDs. The icon to click and location of the first device's ID are shown outlined in red: | ||
| Line 5: | Line 9: | ||
| [[http://digistump.com/wiki/_media/oak/tutorials/particle-device-id.png|{{http://digistump.com/wiki/_media/oak/tutorials/particle-device-id.png?400}}]] | [[http://digistump.com/wiki/_media/oak/tutorials/particle-device-id.png|{{http://digistump.com/wiki/_media/oak/tutorials/particle-device-id.png?400}}]] | ||
| + | |||
| + | === Access token === | ||
| Next, click the bottom icon on the left, shaped like a gear. This will reveal your access token. | Next, click the bottom icon on the left, shaped like a gear. This will reveal your access token. | ||
| Line 12: | Line 18: | ||
| 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''): | + | ===== Testing ===== |
| + | |||
| + | To test that the values are accurate, you can run these ''curl'' commands or simply paste the URL 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> | <code>$ curl https://api.particle.io/v1/devices?access_token=token_here</code> | ||