Opto22

PAC Control REST API

Revised: 6/15/2018 Overview This API provides secure access to a SNAP-PAC-R or -S series controller's variable and I/O tags. Confidentiality for API…

IoT & devices#openapi#iot

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

Revised: 6/15/2018

Overview

This API provides secure access to a SNAP-PAC-R or -S series controller's variable and I/O tags. Confidentiality for API transactions is provided by HTTPS. Authentication uses HTTP Basic Authentication with an API key. An API key ID is submitted in the Basic Authentication userid field and API key value in the password field.

For more information visit: developer.opto22.com

Examples

Read an array of all the integer32 variables defined in the PAC's strategy.
For example, on your SNAP-PAC-R or -S series controller at IP address 1.2.3.4, you would use the URL:

https://1.2.3.4/api/v1/device/strategy/vars/int32s

and provide appropriate authentication. The GET response will be a JSON array of name-value
pairs such as:

[ { "nMyVeryFavoriteNumber": 22 },
  { "nWidgetsProducedToday": 22222 },
  { "DELAY_LOOP_TIME_IN_MSECS"  : 200 } ]

Read the engineering units (EU) of an analog input point configured in the PAC's strategy.
For an analog input (I/O point) named aiTemperatureInDegreesF, use

https://1.2.3.4/api/v1/device/strategy/ios/analogInputs/aiTemperatureInDegreesF/eu

The GET response will be a single JSON name-value pair such as:

{ "value": 72.22 }

Note on packet sizes:

When doing POSTs or GETs, the JSON payload in the body should not exceed 3k (3072 bytes).

Endpoints 55

all

  • GETreadDeviceDetails/deviceReturns controller's type; firmware version; both mac addresses; and uptime in seconds
  • GETreadStrategyDetails/device/strategyReturns the name, date, time, and CRC of the strategy currently in the controller, and the number of charts currently running. Empty strings and a 0 will be…
  • GETreadAnalogInputs/device/strategy/ios/analogInputsReturns the name and engineering units (EU) for all analog input points in the strategy
  • GETreadAnalogInputEu/device/strategy/ios/analogInputs/:ioName/euReads the value in engineering units (EU) of the specified analog input
  • GETreadAnalogOutputs/device/strategy/ios/analogOutputsReturns the name and engineering units (EU) for all analog output points in the strategy
  • GETreadAnalogOutputEu/device/strategy/ios/analogOutputs/:ioName/euReads the value in engineering units (EU) of the specified analog output
  • POSTwriteAnalogOutputEu/device/strategy/ios/analogOutputs/:ioName/euSets the value of the specified analog output point
  • GETreadDigitalInputs/device/strategy/ios/digitalInputsReturns the name and state (true = on, false = off) of all digital input points in the strategy. If there is no strategy in the controller, or the strategy…
  • GETreadDigitalInputState/device/strategy/ios/digitalInputs/:ioName/stateReturns the specified digital input point's state (true = on, false = off)
  • GETreadDigitalOutputs/device/strategy/ios/digitalOutputsReturns the name and state (true = on, false = off) of all digital output points in the strategy
  • GETreadDigitalOutputState/device/strategy/ios/digitalOutputs/:ioName/stateReturns the specified digital output point's state (true = on, false = off)
  • POSTwriteDigitalOutputState/device/strategy/ios/digitalOutputs/:ioName/stateSets the value of the specified digital output point
  • GETreadFloatTables/device/strategy/tables/floatsReturns an array of the name and length of all the float tables in the strategy
  • GETreadFloatTable/device/strategy/tables/floats/:tableName?startIndex=0&numElements=0Read table elements Examples #### * Read all elements in a table named ftable: https://1.2.3.4/api/v1/device/strategy/tables/floats/ftable * Read elements 5…
  • POSTwriteFloatTable/device/strategy/tables/floats/:tableName?startIndex=0Write table elements Examples #### * Write the values (1.5, 2.4, 3.5) to 3 consecutive elements in a table named ftable starting with the element at index…
  • GETreadFloatTableElement/device/strategy/tables/floats/:tableName/:indexRead specified table element
  • POSTwriteFloatTableElement/device/strategy/tables/floats/:tableName/:indexWrite specified table element
  • GETreadInt32Tables/device/strategy/tables/int32sReturns an array of the name and length of all the integer32 tables in the strategy
  • GETreadInt32Table/device/strategy/tables/int32s/:tableName?startIndex=0&numElements=0"Read a range of table elements from the specified integer32 table" Examples #### * Read all elements in a table named itable:…
  • POSTwriteInt32Table/device/strategy/tables/int32s/:tableName?startIndex=0"Write a range of table elements" Examples #### * Write the values (1, 2, 3) to 3 consecutive elements in a table named itable starting with the element at…
  • GETreadInt32TableElement/device/strategy/tables/int32s/:tableName/:indexRead specified integer32 table element
  • POSTwriteInt32TableElement/device/strategy/tables/int32s/:tableName/:indexWrite specified integer32 table element
  • GETreadInt64Tables/device/strategy/tables/int64sReturns an array of the name and length of all the integer64 tables in the strategy
  • GETreadInt64Table/device/strategy/tables/int64s/:tableName?startIndex=0&numElements=0"Read a range of table elements from the specified integer64 table" Examples #### * Read all elements in a table named i64table:…
  • POSTwriteInt64Table/device/strategy/tables/int64s/:tableName?startIndex=0"Write a range of table elements" Examples #### * Write the values (1, 2, 3) to 3 consecutive elements in a table named i64table starting with the element at…
  • GETreadInt64TableAsString/device/strategy/tables/int64s/:tableName/_string?startIndex=0&numElements=0"Read a range of table elements from the specified integer64 table" Examples #### * Read all elements in a table named i64table:…
  • POSTwriteInt64TableAsString/device/strategy/tables/int64s/:tableName/_string?startIndex=0"Write a range of table elements" Examples #### * Write the values (1, 2, 3) to 3 consecutive elements in a table named i64table starting with the element at…
  • GETreadInt64TableElement/device/strategy/tables/int64s/:tableName/:indexRead specified integer64 table element
  • POSTwriteInt64TableElement/device/strategy/tables/int64s/:tableName/:indexWrite specified integer64 table element
  • GETreadInt64TableElementAsString/device/strategy/tables/int64s/:tableName/:index/_stringRead specified integer64 table element as string
  • POSTwriteInt64TableElementAsString/device/strategy/tables/int64s/:tableName/:index/_stringWrite specified integer64 table element as string
  • GETreadStringTables/device/strategy/tables/stringsReturns an array of the name and length of all the string tables in the strategy
  • GETreadStringTable/device/strategy/tables/strings/:tableName?startIndex=0&numElements=0"Read a range of table elements from the specified string table" Examples #### * Read all elements in a table named strTable:…
  • POSTwriteStringTable/device/strategy/tables/strings/:tableName?startIndex=0"Write a range of table elements" Examples #### * Write the values ("first", "second", "third") to 3 consecutive elements in a table named strTable starting…
  • GETreadStringTableElement/device/strategy/tables/strings/:tableName/:indexRead specified table element
  • POSTwriteStringTableElement/device/strategy/tables/strings/:tableName/:indexWrite specified table element
  • GETreadDownTimerVars/device/strategy/vars/downTimersReturns the name and current value of all down timers in the strategy
  • GETreadDownTimerValue/device/strategy/vars/downTimers/:downTimerName/valueReturns current value of the specified down timer
  • GETreadFloatVars/device/strategy/vars/floatsReturns the name and value of all (single-precision) float variables in the strategy
  • GETreadFloatVar/device/strategy/vars/floats/:floatNameReturns value of the specified float variable
  • POSTwriteFloatVar/device/strategy/vars/floats/:floatNameSets the value of a float variable
  • GETreadInt32Vars/device/strategy/vars/int32sReturns the name and value of all integer32 variables in the strategy
  • GETreadInt32Var/device/strategy/vars/int32s/:int32NameReturns value of the specified integer32 variable
  • POSTwriteInt32Var/device/strategy/vars/int32s/:int32NameSets the value of an integer32 variable
  • GETreadInt64Vars/device/strategy/vars/int64sReturns the name and value of all integer64 variables in the strategy
  • GETreadInt64VarsAsStrings/device/strategy/vars/int64s/_stringReturns the name and value as a string of all integer64 variables in the strategy
  • GETreadInt64Var/device/strategy/vars/int64s/:int64NameReturns value of the specified integer64 variable
  • POSTwriteInt64Var/device/strategy/vars/int64s/:int64NameSets the value of an integer64 variable
  • GETreadInt64VarAsString/device/strategy/vars/int64s/:int64Name/_stringReturns value of the specified integer64 variable as a string
  • POSTwriteInt64VarAsString/device/strategy/vars/int64s/:int64Name/_stringSets the value of an integer64 variable as a string
  • GETreadStringVars/device/strategy/vars/stringsReturns the name and value of all string variables in the strategy
  • GETreadStringVar/device/strategy/vars/strings/:stringNameReturns value of the specified string
  • POSTwriteStringVar/device/strategy/vars/strings/:stringNameSets the value of a string variable
  • GETreadUpTimerVars/device/strategy/vars/upTimersReturns the name and current value of all up timers in the strategy
  • GETreadUpTimerValue/device/strategy/vars/upTimers/:upTimerName/valueReturns current value of the specified up timer

API details

Authentication
HTTP Basic authentication (username and password)
Operations
55 operations on 38 pathsGET 38POST 17
Main resources
all 55tables 24vars 19ios 10device 1strategy 1
Response formats
application/json
Description format
Swagger 2.0, API version R1.0a
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the PAC Control REST API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the PAC Control REST API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses HTTP Basic authentication (username and password). Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “readDeviceDetails” (GET /device), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the PAC Control REST API?

Revised: 6/15/2018 Overview This API provides secure access to a SNAP-PAC-R or -S series controller's variable and I/O tags. Confidentiality for API… It is listed under IoT & devices and has 55 endpoints.

Who publishes the PAC Control REST API?

It is listed from Opto22's public API description (an OpenAPI document), not published by Opto22 on Swastik Codes. Anyone who controls opto22.com can claim the profile by adding a DNS TXT record.

How do I authenticate with the PAC Control REST API?

With HTTP Basic authentication (username and password).

How many endpoints does the PAC Control REST API have?

55 operations on 38 paths (38 GET, 17 POST). The largest groups are all, tables, vars, ios.

Is forking the PAC Control REST API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.