views:

356

answers:

1

Hi Im trying to get TripIt OAuth authentication working, but I find the documentation to go a bit over my head. TripIt docs

The paragraph below is from the documentation, I have tried putting together a POST request for a SOAP service where the documentation specified what to put into the headers and how to build an xml for the Http body. In this case I have no idea on how to build my request. I have all the values the service asks for, just no idea of how to set these using only the info given below?

To obtain an authorized access token, POST the following request parameters to the URL: https://api.tripit.com/oauth/access%5Ftoken

  • oauth_consumer_key: The Consumer's public key.
  • oauth_nonce: A nonce no more than 80 characters in length.
  • oauth_signature: The signature of the reque…
  • oauth_signature_method: Current supported methods are HMAC-SHA1.
  • oauth_timestamp: The timestamp in seconds since the epoch.
  • oauth_token: The request token obtained in Step 1.
  • oauth_token_secret: The request token secret obtained in Step 1.
  • oauth_version: OPTIONAL - Assumed to be '1.0'

Could someone help me with how I'll go about building the POST request from the above?

Thank you:)

A: 

The way to do it yourself would be to read up on how the body of a POST request is put together (it looks a lot like a URL query string), build the string out of the various parts, and then use the request's -setHTTPBody: method.

Most people recommend using ASIHTTPRequest, which, among many other things, will do that work for you. See, in particular, the ASIFormDataRequest class, and its -setPostValue:forKey: method.

Here's some more detail on the format of the POST body:

Sixten Otto
Hi OttoThe problem is that every resource I find is extremely vague and I would like to do the whole thing myself this first time around. However, I looked at the ASIHTTPRequest and it is both well documented and seem to do everything I need. Plus I can look in the source for stuff Im confused about. I looked at some other wrappers on google code, but it seems that no one takes the time to document their libraries properly.Thanks:)PS. sorry for sounding a bit disgruntled, just spend half a day going in circles due to a manual that's lacking.
RickiG
I can definitely understand (and applaud) the DIY spirit. And, frankly, I encounter a lot of "web" programmers who don't have the first idea how HTTP works. On the other hand, assembling the POST body isn't particularly interesting work. I'll edit my answer with some links to more detail.
Sixten Otto
Thank you for the extra links. I took the time to skim them and dive into a couple of subjects. It turned out to be a good thing as the next problem I ran into was using Header Authentication:) but that worked out just fine.
RickiG