General Discussions
Query vtscada by restfull webapi

I want to query some data from vtscada by RESTFull WebAPI. For example : http://192.168.1.2:80/web/REST/SQLQuery?query=select timestamp,'Station 1\CommChannel\Level:value' from history

But how I should Authenticate with username and password for REST API ? Thanks.

I want to query some data from vtscada by RESTFull WebAPI. For example : http://192.168.1.2:80/web/REST/SQLQuery?query=select timestamp,'Station 1\CommChannel\Level:value' from history But how I should Authenticate with username and password for REST API ? Thanks.

When you query the API, you will receive a username and password request as part of the initial HTTP(s) handshake.

When you query the API, you will receive a username and password request as part of the initial HTTP(s) handshake.

Trihedral Engineering Ltd.

Hi, Dave, thank u.

If I use postman tool that is like below picture. How should I do the Authenticate with username and password? Thanks.

60f6663249bbe

Hi, Dave, thank u. If I use postman tool that is like below picture. How should I do the Authenticate with username and password? Thanks. ![60f6663249bbe](serve/attachment&path=60f6663249bbe)

Just click into the Authorization tab and set the type to 'Basic Auth'. Then enter the username and password for a user with the 'Remote Data Access' privilege in VTScada.

You may want to add a touch more to your query to get the data you are expecting. Here is an example query I dug up from my history. In this case, I was looking for the records for two tags from the time of my query to the date given, or the latest 100 records in 1s intervals:

https://vtsdemo.trihedral.com/exceldemo/REST/SQLQuery?query=select timestamp,'Liftstations\LS1\Well\Level:Value:Average' AS LS1_Level, 'Liftstations\LS2\Well\Level:Value:Average' AS LS2_Level from history_1S where timestamp > '2021-04-21 12:57:00' limit 100 ORDER BY Timestamp DESC
Just click into the Authorization tab and set the type to 'Basic Auth'. Then enter the username and password for a user with the 'Remote Data Access' privilege in VTScada. You may want to add a touch more to your query to get the data you are expecting. Here is an example query I dug up from my history. In this case, I was looking for the records for two tags from the time of my query to the date given, or the latest 100 records in 1s intervals: ```` https://vtsdemo.trihedral.com/exceldemo/REST/SQLQuery?query=select timestamp,'Liftstations\LS1\Well\Level:Value:Average' AS LS1_Level, 'Liftstations\LS2\Well\Level:Value:Average' AS LS2_Level from history_1S where timestamp > '2021-04-21 12:57:00' limit 100 ORDER BY Timestamp DESC ````

Trihedral Engineering Ltd.

edited Jul 20 '21 at 3:07 pm

@Dave - VTScada I have got the tag data by postman as your guidance. Thank U.

@Dave - VTScada I have got the tag data by postman as your guidance. Thank U.

@flagshang - Thanks for following up on this, I'm glad it worked out for you.

@flagshang - Thanks for following up on this, I'm glad it worked out for you.

Trihedral Engineering Ltd.

Hello @ArghDave ,

Can we also write to the tag from a rest api? If so, how?
TIA!

Hello @ArghDave , Can we also write to the tag from a rest api? If so, how? TIA!

VTScada's REST API is read only (For security) but you can write to tags by creating a server for JSON, XML, or MQTT and using the built-in drivers for either.

VTScada's REST API is read only (For security) but you can write to tags by creating a server for JSON, XML, or MQTT and using the built-in drivers for either.

Trihedral Engineering Ltd.

234
7
3
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