Industrial Automation
Industrial Automation | Europe


Main > Product Type > Software > Visualisation
Minimize Text   Default    Enlarge Text


How To Call REST API From CX-Supervisor

Many internet and cloud sites use Web services with a REST API to share data. This sample program shows how you can use REST API methods from CX-Supervisor.  This example project is written in CX-Supervisor version 4.0
The attached example shows the code used in a Button to call the REST API:
  • Click the address to edit as required
  • Click the button [Post "GET" request] to call the REST API
  • Look at the response returned in the text box

Tip: The website is a third party website which can be used for testing REST API calls. Use the different addresses shown to get different results from the server.

Code used behind the button (txtAPIURL and txtReply should be defined as new Text Points):
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
objHTTP.Open "GET", txtAPIURL, False
txtReply = objHTTP.responseText
Using the demo you can edit the API address to your own address, or one of the test data address examples listed.  The txtReply string can be processed, as depending on the data and format expected.


Attachments - Size: 17804

Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2021-02-24
Modified 2021-02-24
Views 1981


You are not logged in.