Support Forums
HTTPSend function use

I am new to VTScada. I want to call an API with URL having 2 questionable variables in URL. The response is a string type and need to be displayed in VTScada overview. How can I do it with VTScada? Is it possible with HTTPSend Get function? How to call this function from within VTScada application. Can anyone provide me a sample code.

I am new to VTScada. I want to call an API with URL having 2 questionable variables in URL. The response is a string type and need to be displayed in VTScada overview. How can I do it with VTScada? Is it possible with HTTPSend Get function? How to call this function from within VTScada application. Can anyone provide me a sample code.
edited Jun 10 at 1:09 pm

You could write a custom function for that but I'd suggest you start by checking out the JSON driver to see if you can make that work.

When setting up the driver, you can write click the URL and add an expression. use the CONCAT() function create your string containing variables.

You could write a custom function for that but I'd suggest you start by checking out the JSON driver to see if you can make that work. When setting up the driver, you can write click the URL and add an expression. use the CONCAT() function create your string containing variables.

Trihedral Engineering Ltd.

Thanks, Dave.

I have tested it with JSON driver, it does not update response from API if question variable changes in URL. My URL is like "localhost:8080/api/call/?code=1234567&type=0", when I change code the JSON driver does not update the response message.

So, I should write a custom function. The custom function should be written in *.SRC file and that should be mentioned in module section of AppRoot.SRC file. Please guide me further about that, how to call that function and how I can display the response to user through idea studio? Should I use script tag?
It would be more helpful if you share a basic example project (if possible).
@ArghDave

Thanks, Dave. I have tested it with JSON driver, it does not update response from API if question variable changes in URL. My URL is like "localhost:8080/api/call/?code=1234567&type=0", when I change code the JSON driver does not update the response message. So, I should write a custom function. The custom function should be written in *.SRC file and that should be mentioned in module section of AppRoot.SRC file. Please guide me further about that, how to call that function and how I can display the response to user through idea studio? Should I use script tag? It would be more helpful if you share a basic example project (if possible). @ArghDave
edited Jun 11 at 8:19 am

If you check the window where you entered the expression, you'll want to deselect the checkbox which toggles "Optimize to only evaluate at tag initialization".

This should cause the expression to update each time the tag updates. If this is occuring every second, you might want to rethink the expression to make it more efficient as it will cause the JSON driver to restart the tag when the expression changes however, if these variables change on occasion, this should be fine without adding any complexity.

If you check the window where you entered the expression, you'll want to deselect the checkbox which toggles "Optimize to only evaluate at tag initialization". This should cause the expression to update each time the tag updates. If this is occuring every second, you might want to rethink the expression to make it more efficient as it will cause the JSON driver to restart the tag when the expression changes however, if these variables change on occasion, this should be fine without adding any complexity.

Trihedral Engineering Ltd.

Thanks for guiding me,
with JSON driver, I successfully read the data from API.
please also guide me how to POST data (string or analog) to API. I want to send a message back to API according to received data from previous API call.
@ArghDave

Thanks for guiding me, with JSON driver, I successfully read the data from API. please also guide me how to POST data (string or analog) to API. I want to send a message back to API according to received data from previous API call. @ArghDave
51
4
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft