How Can I Retrieve Data From a Website in LabVIEW Using HTTP?

Updated Dec 18, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have to retrieve measurement data from a website using HTTP. How is this done with LabVIEW?

Solution

In order to retrieve any information from a website using HTTP, you will likely use a REST API. A REST API is a set of commands that can be sent to the website to work on different pieces of data. The website administrator should be able to provide some documentation about what command to use to achieve a specific goal, and more specifically, the URL you will need to send the command to.

Assuming that you have this information, you will then have to use the VIs in the HTTP Client Palette (under Data Communications > Protocols) to implement those commands.

Additional Information

Depending on the website, you might have to authenticate yourself when using a REST API. Different websites have different ways of doing it, but a common technique is to require that an API key is added to the HTTP header. To add a specific key a header, you will have to use the AddHeader.vi VI, and type manually the header name, as it probably won't be already in the available list.