Change Your Content Type for HTTP POST.VI or PUT.VI to JSON or XML

Updated Nov 29, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I don't know how to change the POST.vi content type or other lines in the HTTP request. When I go to change the code internally, I see that the block diagram is password protected. 
  • Is it possible to use POST.vi to send XML data through the buffer?

Solution

Looking at the HTTP palette, there’s a folder dedicated to headers.
 

 
In this folder, there’s an Add Header VI. To change the Content-type to a JSON/XML you can use the following syntax:
 


Capture.JPG
Here's another example of the full system for the PUT.vi: 
Code Snippet.png

Additional Information

Content-type is a header in the HTTP request. You can find more information on HTTP request methods->POST.