ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

API in LabView 2010

Hello,

 

I am searching for a way to communicate within labview with API. I am not familiar with API. I received a easy manual on how to control an instrument via a browser. See attachment.

In the command line from chrome I type things like: 

http://192.168.1.100/mmsp/measurement/scans/-1/get

And a receive a reaction from the tool. I would like to do this with labview and get the results in labview.

I have no idea where to start.

Can somebody help me out?

 

best regards,

 

Rens van Geffen

0 Kudos
Message 1 of 3
(3,095 Views)

Looks like you need to load a website. You can use DatasocketRead (DSRead) to do this…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(3,082 Views)

I don't know if GerdW's suggestion will work as I'm not that familiar with datasockets but I have another possible solution:

 

The data that it returns is in JSON string format. You can use the HTTP Client VIs to 'GET' the URL which will return a string just like the data you see in your browser.

 

You will then need to parse the string from JSON to a LabVIEW data type to get your data. LabVIEW 2013 onwards has native JSON support so you can just create a cluster that matches the data type (string name, origin, data { string scannum, string scansize, double array values } etc.) and it will convert for you.

 

If using an older version of LabVIEW, you can either use the string functions to parse it yourself or use an addon/toolkit - there seems to be a few available from a quick google search (https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#sourceid=chrome-psyapi2...


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 3
(3,076 Views)