05-13-2022 10:14 AM
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 🙂
05-13-2022 11:16 AM
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?
05-16-2022 01:30 AM
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.
06-27-2022 11:46 PM
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.
06-28-2022 01:12 AM
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!
09-01-2022 10:05 PM
@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... )