G Web Development Software

cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP POST Multipart - Error 1072

Hey!

 

I'm trying to send a few parameters and a file to an web server by using the HTTP POST method of G WEB. Unfortunately I'm running into error 1072 which has zero documentation or error explanation. All I could "find" is that all of the polymorphic instances of the POST method are making use of an disable structure. The enabled case is "TARGET_TYPE == WebServer" which is raising the error but only for "POST Multipart" and "POST File".

The documentation states nothing about a reason why I can't use Multipart or File for the POST method.

 

I need to send the POST request with multipart/form-data but I'm stuck here. It still feels like I'm missing something but I can't figure it out. Maybe someone else can enlighten me a bit 🙂

0 Kudos
Message 1 of 6
(2,054 Views)

Hey Jens_S,

 

Currently the POST File and POST Multipart VIs are not supported in G Web. It's partly because G Web does not have built-in support for the File types.

 

What are your use-cases for using POST File / POST Multipart?


Milan
0 Kudos
Message 2 of 6
(2,046 Views)

Hey MilanR,

 

Thanks for your quick response but that's bad news for me cause I need to upload and send a firmware file. The file itself is basically a text file so I could use the file example from https://github.com/rajsite/webvi-experiments/tree/main/File. But the web API is expecting the file and a few parameters as multipart form data. I'm not a web development expert at all so I'm not sure if it is even possible to create the web request "by hand".

 

I wonder why these VI's are even there if we can't use them, that's very misleading.

0 Kudos
Message 3 of 6
(2,006 Views)

Hey Jens_S,

 

In the latest release of the File for WebVI example I added an example library called HTTPExtensions with a Post Multipart Ex - String VI that is capable of creating HTTP Post requests using the Content-Type multipart/form-data. It may be a useful starting point / example for creating Post Multipart requests from a WebVI.


Milan
Message 4 of 6
(1,921 Views)

Hey Milan,

 

Thanks for your message, that's some good news. I'm gonna take a look into it when I have some spare time. It's really nice to see that the WebVi-Experiments are still being updated. A lot of the projects there should already be part of G Web cause they just work.

 

So thanks for your update!

0 Kudos
Message 5 of 6
(1,916 Views)

@Jens_S wrote:

The documentation states nothing about a reason why I can't use Multipart or File for the POST method.


If you're still looking for a solution, you can use the JavaScript Library Interface to sent multipart POST requests (see https://forums.ni.com/t5/SystemLink/Systemlink-API-requests-via-javascript/m-p/4102197/highlight/tru... )

Certified LabVIEW Developer
Message 6 of 6
(1,812 Views)