Hi Justin,

Don't suppose you have an example of a C# Httpwebrequest POST that is
sent to Twitpic with an image attachment?

I've actually found now that my headers are ok but from a trace have
determined that the 401 error is because of 'no api key provided'.

I thought it was ok to simply append parameters to the post Url?

example:

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://
api.twitpic.com/2/upload.json?key=XXXXXXXXXX&message=TestMessage");

Or do I need to add the parameters to the post body along with the
image data?

Thanks
Gerard




On Jul 27, 6:52 am, globaljobber <gerardn...@exciteinternet.co.uk>
wrote:
> Thanks for replying Justin, much appreciated. Sloooowly getting there
> - I hope!
>
> Gerard
>
> On Jul 27, 5:55 am, Justin Hart <onyxra...@gmail.com> wrote:
>
>
>
> > Oop, it looks like you've moved on (in a different thread).  I'm
> > actually working on some OAuth stuff in C# right now so I'll let you
> > know if I come across something.
>
> > On Jul 26, 10:49 pm, Justin Hart <onyxra...@gmail.com> wrote:
>
> > > I think I see what you're doing wrong - when you're adding the "X-Auth-
> > > Service-Provider" and "X-Verify-Credentials-Authorization" to the
> > > request, those are meant to be HTTP headers, not in the multipart POST
> > > body.
>
> > > Twitgoo supports putting those in the post body by setting everything
> > > to lowercase and replacing - with _ (so x_auth_service_provider, etc),
> > > and I believe Twitpic does as well.  I'm pretty sure everything else
> > > looks right.
>
> > > I have an example HTTP packet including all the headers for 
> > > Twitgoo:http://twitgoo.com/docs/Content/Developer/upload.htm(Itsinthe
> > > example link 'pulldown' in the top section)
>
> > > On Jul 25, 11:57 pm, globaljobber <gerardn...@exciteinternet.co.uk>
> > > wrote:
>
> > > > Thanks Andy,
>
> > > > No that was just a typo on the post. I'm obviously not sending through
> > > > the correct OAuth sig or something, just can't find what it is. I'm
> > > > using the same mechanism to create the sig as that used to get an
> > > > access token and for intial request of the request token, so not sure
> > > > why this twitpic upload thing isn't working.
>
> > > > It would be great if there were an asp.net example someone else had
> > > > done but it's incredible that I can't find one on the net, First time
> > > > ever not been able to find a working example!
>
> > > > Gerard
>
> > > > On Jul 26, 3:58 am, Andy Matsubara <andymatsub...@gmail.com> wrote:
>
> > > > > Just for doublechekking.
>
> > > > > Your first post showed "X-Auth-Service-Provider" was JSON. If you 
> > > > > signed to
> > > > > "https://api.twitter.com/1/account/verify_credentials.xml";,
> > > > > X-Auth-Service-Provider
> > > > > also must be XML.
>
> > > > > Andy
>
> > > > > On Sun, Jul 25, 2010 at 5:03 AM, globaljobber
>
> > > > > <gerardn...@exciteinternet.co.uk> wrote:
> > > > > > Hi Andy, thanks for replying.
>
> > > > > > Yes, I did sign the url as you mention.
>
> > > > > > As a test, I also sent a request to
>
> > > > > > "https://api.twitter.com/1/account/verify_credentials.xml";
>
> > > > > > From this I get authorization ok using a standard call when using an
> > > > > > "Authorization" header, but as soon as I use the header "X-Verify-
> > > > > > Credentials-Authorization" then I get the 401 not authorized.
>
> > > > > > I created the signed request using a GET not a POST, then modify the
> > > > > > Realm part, as instructed by other posts. The credentials were 
> > > > > > creatd
> > > > > > using the request url of "https://api.twitter.com/1/account/
> > > > > > verify_credentials.xml".
>
> > > > > > As far as I can tell, I am doing everything correctly - but 
> > > > > > obviously
> > > > > > not. Can't fathom what the problem is, I wish Twitter API provided
> > > > > > more feedback for debugging.
>
> > > > > > Regards
> > > > > > Gerard
>
> > > > > > On Jul 24, 12:40 pm, Andy Matsubara <andymatsub...@gmail.com> wrote:
> > > > > >> Did you sign to 
> > > > > >> thehttps://api.twitter.com/1/account/verify_credentials.jsontogetthe
> > > > > >> credentials?
> > > > > >> The signed url must be the same as X-Auth-Service-Provider.
>
> > > > > >> Andy Matsubara
>
> > > > > >> On Sat, Jul 24, 2010 at 10:57 PM, globaljobber
>
> > > > > >> - Hide quoted text -
>
> > > > > >> - Show quoted text -<gerardn...@exciteinternet.co.uk> wrote:
> > > > > >> > Hi,
>
> > > > > >> > Been on this for a week. Am having trouble uploading image to 
> > > > > >> > Twitpic
> > > > > >> > with Oauth. I get user to authenticate ok, receive access_token, 
> > > > > >> > etc.,
> > > > > >> > and then try to make a httpwebrequest POST after generating 
> > > > > >> > X-Verify-
> > > > > >> > Credentials-Authorization string.
>
> > > > > >> > I am always getting a 401 Unauthorized Access response. Has 
> > > > > >> > anyone
> > > > > >> > anywhere on the planet done this with ASP.NET yet who could help?
> > > > > >> > Seems no one has.
>
> > > > > >> > Here is part of the post that I generate, including headers:
>
> > > > > >> > --76a18be812b446b599adabd8c9b6fee0
> > > > > >> > Content-Disposition: form-data; name="X-Auth-Service-Provider"
>
> > > > > >> >https://api.twitter.com/1/account/verify_credentials.json
> > > > > >> > --76a18be812b446b599adabd8c9b6fee0
> > > > > >> > Content-Disposition: form-data; name="X-Verify-Credentials-
> > > > > >> > Authorization"
>
> > > > > >> > OAuth realm="http://
> > > > > >> > api.twitter.com/",oauth_consumer_key="9cjtDDCxlOYSSJqyp7XKzA",oauth_nonce="
> > > > > >> >  ­6C850587",oauth_signature_method="HMAC-
> > > > > >> > SHA1",oauth_timestamp="1233928528",oauth_token="15321156-7q4tTvSwJ9oB6iWZh7
> > > > > >> >  
> > > > > >> > ­DvRjkn60eKTc1T4VRkNl4",oauth_version="1.0",oauth_signature="9FJK45EJtW4Efp
> > > > > >> >  n­Jla6S
> > > > > >> > %2BGIqvuE%3D"
> > > > > >> > --76a18be812b446b599adabd8c9b6fee0
> > > > > >> > Content-Disposition: form-data; name="message"
>
> > > > > >> > Test image upload
> > > > > >> > --76a18be812b446b599adabd8c9b6fee0
> > > > > >> > Content-Disposition: form-data; name="key"
>
> > > > > >> > 97bfc758472981ds9630232def4eea82
> > > > > >> > --76a18be812b446b599adabd8c9b6fee0
> > > > > >> > Content-Disposition: file; name="media"; 
> > > > > >> > filename="DSC_222222.jpg"
> > > > > >> > Content-Type: image/jpeg
>
> > > > > >> > Much appreciate any help from someone.
> > > > > >> > Thanks
> > > > > >> > Gerard- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to