'Call Api with body as multipart/form-data

i have to call an Api that get a body as multipart/form-data with 4 parameters. I have done so:`

MultipartFormDataContent body = new MultipartFormDataContent();
body.Add(new StringContent("item_id"), value);
body.Add(new StringContent("ateco_code"), value);
body.Add(new StringContent("province"), value);
body.Add(new StringContent("csv_data"), value);

And then transform the body into stream because Api want a stream (System.IO.Stream body) var bodystream = body.ReadAsStreamAsync().Result;

It's correct? Because i get always BAD REQUEST



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source