Can someone give me an example of framing the POST request to /statuses/update.json endpoint which includes media_id parameter??
Currently I have the request as below:
// CODE STARTING POINT
WebClient m_twitWebClient = new WebClient();
string boundary = Guid.NewGuid().ToString();
string header = string.Format("--{0}", boundary);
string footer = string.Format("--{0}--", boundary);
string message_to_post = "Posted from Windows application"
StringBuilder contents = new StringBuilder();
contents.AppendLine(header);
contents.AppendLine(String.Format("Content-Disposition: form-data; name=\"{0}\"", "status"));
contents.AppendLine();
contents.AppendLine(message_to_post);
contents.AppendLine(header);
string fileHeader = String.Format("Content-Disposition: file; name=\"{0}\"; filename=\"{1}\"", "media[]", "MyFileName");
byte[] image = File.ReadAllBytes("image file full path");
string fileData = queryEncoder.GetString(image);
contents.AppendLine(fileHeader);
contents.AppendLine(String.Format("Content-Type: {0}", "image/jpeg"));
contents.AppendLine(String.Format("Content-Transfer-Encoding: binary"));
contents.AppendLine();
byte[] bytes1 = Encoding.UTF8.GetBytes(contents.ToString());
contents = new StringBuilder();
contents.AppendLine(fileData);
contents.AppendLine(footer);
byte[] bytes2 = Encoding.GetEncoding(contentEncoding).GetBytes(contents.ToString());
byte[] bytes = new byte[bytes1.Length + bytes2.Length];
System.Buffer.BlockCopy(bytes1, 0, bytes, 0, bytes1.Length);
System.Buffer.BlockCopy(bytes2, 0, bytes, bytes1.Length, bytes2.Length);
try
{
m_twitWebClient.UploadDataAsync(new Uri("https://api.twitter.com/1.1/statuses/update.json"), bytes);
}
//CODE ENDING POINT
This works fine for uploading the status, but I need to update the media as well by including the media id. I have obtained media_id by sending the request to /media/upload endpoint. But not sure how to include it in this end point.
Can someone suggest me how it can be done.