Support Forums
Passing parameters in the URL when using the VTScada JSON Driver

This question was left on our YouTube tutorial for the VTSCada JSON driver found here...
https://www.youtube.com/watch?v=gegzTIR88EE

Question: "Can you pass functions or vtscada parameters in the URL? I.e I want to use the latitude and longitude which are specified in the parent of the JSON/XML tag?"

Answer: Absolutely. You can put parameter expressions in the URL which reference VTScada values. We do this in our weather example.

Here is an example. (NOTE, you are fully responsible for testing any code or expressions found on this forum before deploying to an active system.)

api.openweathermap.org/data/2.5/weather?q=" + PickValid([newCityAreaNoSpace],"new%20york") + "," + PickValid([newCountryCode],"us") + "&units=" + PickValid([selectedUnits], "imperial")+ "&,id=524901&APPID=??????????????????????????

You can add this in the JSON/XML driver properties in the URL field found on the Settings Tab.

This question was left on our YouTube tutorial for the VTSCada JSON driver found here... https://www.youtube.com/watch?v=gegzTIR88EE Question: _"Can you pass functions or vtscada parameters in the URL? I.e I want to use the latitude and longitude which are specified in the parent of the JSON/XML tag?"_ Answer: Absolutely. You can put parameter expressions in the URL which reference VTScada values. We do this in our weather example. Here is an example. (NOTE, you are fully responsible for testing any code or expressions found on this forum before deploying to an active system.) ```` api.openweathermap.org/data/2.5/weather?q=" + PickValid([newCityAreaNoSpace],"new%20york") + "," + PickValid([newCountryCode],"us") + "&units=" + PickValid([selectedUnits], "imperial")+ "&,id=524901&APPID=?????????????????????????? ```` You can add this in the JSON/XML driver properties in the URL field found on the Settings Tab.

Note, for the sample code to work, you will need to sign up for a free open weather map account to get your own API key. Once you have an account, you can set up free, or paid, API keys here: https://home.openweathermap.org/api_keys

In the sample code, replace the question marks with your key where you see APPID=?????????

Note, for the sample code to work, you will need to sign up for a free open weather map account to get your own API key. Once you have an account, you can set up free, or paid, API keys here: https://home.openweathermap.org/api_keys In the sample code, replace the question marks with your key where you see APPID=?????????

Trihedral Engineering Ltd.

edited Nov 20 '20 at 12:55 pm

Hi I have a JSON driver application which has an API key. I've added it to the Additional HTTP Headers section and dont get anything in return.
If I cURL the URL with the API key I can see the JSON structure and values with no problem.
Is there any trick to get the API key into the driver in VTS?

Hi I have a JSON driver application which has an API key. I've added it to the Additional HTTP Headers section and dont get anything in return. If I cURL the URL with the API key I can see the JSON structure and values with no problem. Is there any trick to get the API key into the driver in VTS?

@rovidal - Typically I would expect you can put this key in the URL as a parameter or in the password field. I would suggest getting a program called Postman to test your api as this should give you some simple ways to check the best way to connect and read the responses to get your data into VTScada.

@rovidal - Typically I would expect you can put this key in the URL as a parameter or in the password field. I would suggest getting a program called Postman to test your api as this should give you some simple ways to check the best way to connect and read the responses to get your data into VTScada.

Trihedral Engineering Ltd.

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