OptoBlog

OptoNews Tip: Peer-to-peer with REST

Posted by Jean Femia on Aug 31, 2016 4:25:57 PM

SNAP PAC R-series programmable automation controller with a RESTful APIHere's the latest Code Samples and Tips contribution in our new OptoForum: an example of easier peer-to-peer communication between PAC controllers.

This example takes advantage of the new RESTful API in SNAP PAC hardware controllers (both the standalone S-series and the rack-mounted R-series). 

Download the sample, a single-chart strategy, and you'll be able to read and write to tags on a SNAP-PAC-R1 at our headquarters in California, using the RESTful server on the PAC. 

Within the sample you'll see subroutines illustrating how to write (POST) values to a remote PAC and how to read (GET) values from it.

NOTE: For this example the PAC-R uses HTTP rather than the secure HTTPS. Make sure when you set up your own PAC that you don't put it directly on the Internet. We always recommend that your SNAP PAC controller be located behind a firewall and use the secure HTTPS server. 

See the peer-to-peer sample

See the sample strategy

Topics: optonews, OptoNews 2016-08-31, API, REST API, REST, RESTful server, PACs, PAC Control, IoT, Internet of Things, Tips

Written by Jean Femia

Jean Femia writes about technical subjects and has focused on automation and control systems for more than 15 years. She likes learning about technology and taking corners in her Honda S2000.
Find me on:

Subscribe to Email Updates

Recent Posts

Posts by Topic

see all