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
No, unfortunately not. I've tried all combinations i could think of but they didn't work either.
"key":"value"
"key":value
key:value
key:"value"
"key"="value"
"key"=value
key=value
key="value"
To date, the only place i can get it working is in the build in postman x-www-form-urlencoded body tab. Which confirms the API is working ultimately, but i presume there is some different formatting within there that i don't know.
Hi , @scales23456
Can you try to delete the "" in your body if it can help?
media_data=iVBORw.........II
Best Regards,
Yueyun Zhang
HTTP Connector for reference. I've tried every combination i can think of it the body