Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I'm trying to figure out how to use HTTPClient to upload a picture using the TwitPic API. The API requires that you send some headers (for authorization), then two key/value pairs, one of which includes the image data. The curl command shown below is an example:
curl -v -H 'X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json' -H 'X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/", oauth_consumer_key="GDdmIQH6jhtmLUypg82g", oauth_signature_method="HMAC-SHA1", oauth_token="819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw", oauth_timestamp="1272325550", oauth_nonce="oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y", oauth_version="1.0", oauth_signature="U1obTfE7Rs9J1kafTGwufLJdspo%3D"' -F "key=098f6bcd4621d373cade4e832627b4f6" -F "media=@/path/to/image" http://api.twitpic.com/2/upload.jsonI think I can use
setRequestHeader("X-Auth-Service-Provider","https://api.twitter.com/1/account/verify_credentials.json") setRequestHeader("X-Verify-Credentials-Authorization: OAuth realm=\"http:\\ [...and so forth...]")to deal with the first two lines. But is there any way to send two key/value pairs, one of which reads part of its data from a file, all in the same POST using HTTPClient? Maybe the secret is to use HTTPStream?