I’m trying to use the twitter media API to upload an image and i’m struggling to understand how to structure the body of the HTTP connector into x-www-form-urlencoded body type. I've been trying to replicate the same using the Postman 'raw' body type and can't get it to work there either, but i can get it to work through the x-www-form-urlencoded body within Postman
If i create a variable ‘media=iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII’ I can generate a 200 response using the x-www-form-urlencoded body
When i put the same body in Raw with a forced x-www-form-urlencoded header I get a 401 Unauthorized (which i think is just a poor error message bubbling up giving my Auth headers aren’t changing. The same thing happens in my PowerAutomate flow.
I presumed this was to do with URLEncoding, so i encoded the value to the below, but this doesn't work in either PowerAutomate or the HTTP connector. Whats more confusing, is the encoded value stops the x-www-form-urlencoded tab working within Postman too.
Does anyone know how to structure the HTTP conector body, so it will simulate the same behaviour I get when using the x-www-form-urlencoded tab?
Encoded
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD%2BwSzIAAAABlBMVEX%2F%2F%2F%2B%2Fv7%2BjQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD%2FaNpbtEAAAAASUVORK5CYII
Request:
POST https://upload.twitter.com/1.1/media/upload.json?
Documentation:
POST media/upload | Docs | Twitter Developer Platform