LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start connect and comm with server using REST (GET, POST...)

Hi,

 have used LV for 15 years but I'm a newbee using LV and web communication. I need to connect to a server using a HTTP commands and send log-data to that server. The API consist of GET, PUT, POST, PATCH and DELETE. 
I also need to have a auth in the header. It seems that I need to use GET to fetch a token but that must be the private key or?

 

I have some example-code in bash (linux). Not difficult to understand. However, I don't know how to start. Do I start with OpenHandle? 

 

Can anyone here give me a hint how to start? Any examples? If I send data every minute, do I need to reconnect every time or can I have the connection open until application ends?

 

(Let me guess:  I need to use Data Communication/Protocols/HTTP Client? Set API-key?)

 

0 Kudos
Message 1 of 17
(2,058 Views)

I need a Nap, Hi TakeANap!

 

I am fairly new to LabView, but following are the few things I implemented and used in Web API- LabView communication using HTTP:

 

1) Finding VIs: Functions Pallet- Data Communication- Protocols-HTTP

 

2) Block Diagram for GET: (Use private key only if applicable)

Xonmyth743_0-1608038354961.png
2) Block Diagram for POST: (Use private key only if applicable)

Xonmyth743_1-1608038491669.png

 

I hope this helps in someway.

 

I am a dummy for web communication, but for connection open, maybe try and test it. You may have to add an idle case where the reference is stored in shift registers and no VI is using it then change the case as desired and use the reference from shift register.

 

I would try my best to answer any specific question you may have.

 

Good Luck!

 

 

Message 2 of 17
(1,986 Views)

huh! my response is not there anymore. That's rude.

0 Kudos
Message 3 of 17
(2,000 Views)

What are the while loops for? They don't do anything...

 

Other than the while loops and the coloring of the structure diagrams that is the way to do it.

0 Kudos
Message 4 of 17
(1,974 Views)

@XM43 wrote:

huh! my response is not there anymore. That's rude.


Unless the response itself was rude, it's probably a technical problem.

 

Only moderators can remove posts, and they won't unless it's reported and there's a reason.

0 Kudos
Message 5 of 17
(1,970 Views)

wiebe@CARYA wrote:

What are the while loops for? They don't do anything...

 

Other than the while loops and the coloring of the structure diagrams that is the way to do it.


Yes Sir! my mistake, while loops are there as part of my template VI. But yes, it does not do anything.


Please now that I am new to LabView, actually 6 months into any kind of programming. So yes, I am playing with every possible thing that I come across in LabView including background colors.

0 Kudos
Message 6 of 17
(1,967 Views)

wiebe@CARYA wrote:

@XM43 wrote:

huh! my response is not there anymore. That's rude.


Unless the response itself was rude, it's probably a technical problem.

 

Only moderators can remove posts, and they won't unless it's reported and there's a reason.


Okay, understood. I hope my response was not rude.

0 Kudos
Message 7 of 17
(1,965 Views)

@XM43 wrote:

wiebe@CARYA wrote:

What are the while loops for? They don't do anything...

 

Other than the while loops and the coloring of the structure diagrams that is the way to do it.


Yes Sir! my mistake, while loops are there as part of my template VI. But yes, it does not do anything.


Please now that I am new to LabView, actually 6 months into any kind of programming. So yes, I am playing with every possible thing that I come across in LabView including background colors.


Sure. Kudo for posting!

 

Note you can also color the structures themselves. But (also) please don't.

0 Kudos
Message 8 of 17
(1,959 Views)

wiebe@CARYA wrote:

@XM43 wrote:

wiebe@CARYA wrote:

What are the while loops for? They don't do anything...

 

Other than the while loops and the coloring of the structure diagrams that is the way to do it.


Yes Sir! my mistake, while loops are there as part of my template VI. But yes, it does not do anything.


Please now that I am new to LabView, actually 6 months into any kind of programming. So yes, I am playing with every possible thing that I come across in LabView including background colors.


Sure. Kudo for posting!

 

Note you can also color the structures themselves. But (also) please don't.


Haha, yes, I do not do that anymore and I will keep that in mind. But a bit darker color is soothing for eyes especially if you are working for longer hours.

Oh and thank you for Kudos 😀

0 Kudos
Message 9 of 17
(1,953 Views)

@XM43 wrote:

wiebe@CARYA wrote:

@XM43 wrote:

wiebe@CARYA wrote:

What are the while loops for? They don't do anything...

 

Other than the while loops and the coloring of the structure diagrams that is the way to do it.


Yes Sir! my mistake, while loops are there as part of my template VI. But yes, it does not do anything.


Please now that I am new to LabView, actually 6 months into any kind of programming. So yes, I am playing with every possible thing that I come across in LabView including background colors.


Sure. Kudo for posting!

 

Note you can also color the structures themselves. But (also) please don't.


Haha, yes, I do not do that anymore and I will keep that in mind. But a bit darker color is soothing for eyes especially if you are working for longer hours.

Oh and thank you for Kudos, my first Kudos 😀


Actually your 2nd.

 

You got the first here: Solved: Re: Requesting suggestion for possible software architecture design with PC- RT-& FPGA

 

EDIT: Never mind, that crossed.

0 Kudos
Message 10 of 17
(1,946 Views)