RESTful API Call From Cache to Particle.io Electron
Tom Fitzgibbon | Multidata | 212-967-6700 x537 | firstname.lastname@example.org
Summary: Simple Blink Tutorial for Particle.io Electron Device from Cache
Electron device is a tiny ARM processor ($40-$60) that connects to Particle’s world wide leased 2G/3G network (about $3/mo) and runs off an included LiPo battery. Using Cache’s %Net.HttpRequest you can send/receive data, control hardware and read sensors.
Step by Step (about 1 hour)
1) Get the Electron from store.particle.io.
2) Set up the Electron from setup.particle.io.
3) Install an LED and resistor from setup instructions.
4) Test with build.particle.io using their code for “Web-Connected LED”. You get your access_token from Settings and device number from Devices in Build and substitute in their code. Edit the code to make sure you can light the LED from a browser before moving to step 5.
5) Setup an SSL configuration in your Cache via the SMP (System Management Portal) in Security/SSLTLS configurations. Just create a new SSLTLS configuration by entering a name (like TLS) and saving.
6) Run the following Cache code from an internet connected Mac or PC after substituting your access_token, device number and on/off in args. Do ^LED1 from Cache terminal.
LED1 ;simple blink test with Cache
Do httprequest.InsertFormData("access_token”,”your access token here“)
Do httprequest.Post("/v1/your device number here/led")
7) You can also test from a Linux Curl command:
curl https://api.particle.io/v1/devices/your device number/led -d access_token=your access_token -d args=on