how i can send binary data with post metht to RESTful api?
i should upload document with restful api. the Description of the post Functions is.
The (binary)content of the file should be sent as POST data.
how i can do it?
i try with the code:
using RestSharp;
using System.Text;
using System.IO;
...
var client = new RestClient("https://myServer.com/rest/");
client.AddHandler("text/html", new RestSharp.Deserializers.JsonDeserializer());
var contactsRequest = new RestRequest("Documents?f=1&name=file.jpg", Method.POST);
var bytes = File.ReadAllBytes(@"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg");
contactsRequest.AddBody(bytes);
var contacts = client.Execute(contactsRequest);
but it throw Exeption
The '[' character, hexadecimal value 0x5B, cannot be included in a name.