Receive image from POST request

Hello everyone, I’m new to this forum so I’m sorry if I’m not posting this in the correct place. I’m building an app using Unity and I’m going to need to send a bunch of numbers to a web service and it will generate a graph (quickchart.io). Then i will use that image as a sprite and show it in the UI. I want to use a POST request so this data isn’t visible through the URL but I can’t find enough documentation to know if this is possible.

I’ve read about using IMultipartFormSection but i don’t know if that will allow me to store the result as a texture. Also I’ve seen you can use UnityWebRequest.Texture to store the texture but this doesn’t work with POST request. What solution could be best? Thanks in advance.

What you need is:

  • Create a request using UnityWebRequest.Post
  • Assign DownloadHandlerTexture to downloadHandler property

The UnityWebRequest.Post and UnityWebRequestTexture.GetTexture are just convenience helper to set things up. All they actually do is setup main UnityWebRequest properties, such as method, uploadHandler, downloadHandler.

Networking, UnityWebRequest, WWW, Postman, curl, WebAPI, etc:

https://discussions.unity.com/t/831681/2

https://discussions.unity.com/t/837672/2

And setting up a proxy can be very helpful too, in order to compare traffic:

https://support.unity.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity