Open Automation Software
Moving Data From Anywhere to Anywhere
1-303-679-0898

HTTP API JSON Data Structures

Any client that can make HTTP calls using JSON data structures can call the API to perform any of the following functions. All urls are relative to the base OPCSystems Service address with a port designated for the HTTP calls. Urls follow the pattern:

<protocol>://<server>:<port>/OPCREST<operation>

Example:

http://your.server.com:58725/OPCREST/gettoken

The API and client library utilizes the JSONP pattern to allow for greater flexibility in deployment without the need for the OPCSystems Service and the web application to be on the same domain. As such, all calls to the API are HTTP GET commands with UrlEncoded data sent as parameters. The required parameters for all API calls are as follows:

callback : <string>

The JSONP callback name. If not implementing the JSONP pattern in the client itself, this can be any string and will be the function name returned by the server containing the response data.

message : <string>

A UrlEncoded string that is the JSON structure required for the particular request. So if you wanted to pass in the necessary structure for executing a call to gettoken, you would pass the following JSON into the message parameter:

{%22un%22:%22someuser%22,%22pw%22:%22somepassword%22}

So, a full example of a call to an OAS server to execute the gettoken operation would look like the following:

http://your.server.com:58725/OPCREST/gettoken?callback=mycallback&message={%22un%22:%22someuser%22,%22pw%22:%22somepassword%22}

Also following the JSONP pattern, the response will take on the form of a JavaScript function with a single parameter containing the JSON response data. For example, if the request parameter for callback was passed a value of “mycallback”, the response would take the following form:

mycallback(<JSON data>);

So using the full example above, you would get something similar to the following as a response:

mycallback({"message":"94ae2a8e-8c20-4578-88a8-bc8089dedb63","status":"OK"});