Hi,
I’m using C# .NET to try and POST an image to the media/upload.json end-point.
I’m not sure why, but I’m getting a 401. Here is the basic flow of my PerformRequest method.
- Build baseString (including parameter “media” and base64 encoded image)
- Sign / hash the request
- Build the
HttpWebRequest header (method=POST, ContentType=application/x-www-form-urlencoded)
- Write the bytes of “media=” and the base64 string of the image data to the
HttpWebRequest request stream
- Get the response and carry on.
I use the exact same function for posting a status update, including replying to tweets and it works fine.
Are the parameters I’m using wrong? Am I not meant to include the “media” parameter as part of the signature for media posts? Am I meant to URI Encode the base64 string for the image data?
I am posting on here because I can’t find much else that doesn’t use a 3rd party library.
How recently did Twitter deprecate the update_with_media end-point?
Many thanks for any assistance or guidance.
Ross
Edited:
I have looked at Uploading Base64 Encoded Image using /1.1/media/upload.json which seems to answer some of my questions but I still get the 401.