Upload files to WS via the REST API

Dear developers,

I am trying to upload a wsxz file back to WS using the API. I use the following code:

var client = new HttpClient();
client.BaseAddress = new Uri(srvAddress);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/octet-stream"));

Byte[] fileBytes = File.ReadAllBytes(wsxzFilePath);

HttpContent fileStreamContent = new ByteArrayContent(fileBytes);
var response = client.PostAsync(" /ws-api/v1/files?token=" + token, fileStreamContent).Result;

The response I am receiving is 406-Not acceptable.

What do I miss in here?

Thanks in advance for your support.

Regards,

Laurent

Parents Reply Children
No Data