Advertisement
teocomi

Redmine REST upload file

Oct 21st, 2013
1,437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. Redmine redmine = new Redmine();
  2. RestClient client = new RestClient("http://localhost/redmine/");
  3. client.Authenticator = new HttpBasicAuthenticator("myuser", "mypsw");
  4. var request2 = new RestRequest("uploads.json", Method.POST);
  5. request2.AddHeader("Content-Type", "application/octet-stream");
  6. request2.RequestFormat = RestSharp.DataFormat.Json;
  7. byte[] dataToSend = File.ReadAllBytes(AddIssue.attach.Text);
  8. request2.AddBody(dataToSend);
  9. IRestResponse response2 = client.Execute(request2);
  10. resultbox.Text = response2.Content;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement