Weather from

<< Click to Display Table of Contents >>

Navigation:  Examples > HTTP requests >

Weather from

Previous pageReturn to chapter overviewNext page has a convenient API for reading weather data. After registering on the site, you will receive a unique access key (API Access Key), which must be used in GET requests to obtain weather data. In the weatherstack documentation you can look at examples of requests and  create a request, for example, for Berlin it should be like this:


Instead of API_ACCESS_KEY, you need to insert the access key received during registration. Please note that if you need to pass a parameter containing a space, for example "New York", then the space must be replaced with "%20", that is, "New%20York". You can check the validity of the request by pasting it into the address bar of your browser:




The browser displayed a response with the correct data, indicating that the request was made correctly. As you can see, the response is sent in JSON format, later we will extract the properties we need from it.

Now we can start solving the problem in TeslaSCADA2.

1. First, let's create an interface in the project. Temperature, pressure, wind, humidity and local time will be displayed using Text/EditField objects. In the CityName field we activate the Output value property to be able to change the name of the city. The image below shows the created interface and the names we gave to the components:






2. Create tags for each text object and bind them:





3. Now let's create a script in ST language that will be executed when you click on the screen:




The text of ST script below:




Change API_ACCESS_KEY to your key that you get from site.

After you have recorded the script, be sure to launch it by clicking the button on the toolbar: runsimulation


4. Let's Run simulation to check the settings:




You can download this project here.