Forums | Users |
Search | Signup | Login

HTTP Headers

Subscribe to HTTP Headers 7 post(s), 2 voice(s)

 
Avatar KingKovifor 8 post(s)

Hey. What HTTP headers do I need to set?

I know the “application” field (set to Application/XML). Would I need a “Method:” field, a “Username” field, and a “Password” field. This is causing me some problems within this little code…

Jeremy

 
Avatar Joshua Frappier Administrator 241 post(s)

Jeremy,

I would strongly suggest referencing the Unfuddle API documentation. You will find a plethora of examples in a number of languages illustrating how to best interact with the Unfuddle API. The documentation is available at http://unfuddle.com/docs/api

In general, however, you will typically need to set the following HTTP headers:

  • Authorization (i.e. “Authorization: Basic <base64encodedcredentials>)
  • Accept (i.e. “Accept: application/xml”)
  • Content-type (i.e. “Content-type: application/xml”)

I hope that helps.

Josh

 
Avatar KingKovifor 8 post(s)

I actually did check the API first. Now my problem is the fact that none of the examples are remotely close to the language I am using which asks me for a field name and a value for that field. This is done before I send the request.

 
Avatar Joshua Frappier Administrator 241 post(s)

Jeremy,

From our previous conversations, I suspect you are looking for help accessing RESTful web services using Cocoa. Unfortunately, we do not do any Cocoa development over here, so I would just be Googling around like you for an answer.

Perhaps someone out there could provide an example of accessing the Unfuddle API with Cocoa. Anyone?

Josh

 
Avatar KingKovifor 8 post(s)

You would be correct. The only way to create HTTP headers is through code that goes like this:

NSMutableURLRequest setValue:"Value" forHTTPHeaderField:“Field”

Now if they are userpass, and “method” (post get ect.), I should be good. What does your end look for for authentication? But I will Google.

 
Avatar Joshua Frappier Administrator 241 post(s)

Jeremy,

The C# or JavaScript examples from the Unfuddle API docs have good examples of how to do HTTP Basic authentication. I suspect that it will be similar in Cocoa.

In general, authentication is performed by passing a header called “Authorization” with a value of (in pseudo code):

'Basic ' + Base64.encode(username + ':' + password)

Good luck!

 
Avatar KingKovifor 8 post(s)

Oh. It is called “Authorization”! That is so much easier. Now I need to figure out how to use the Get or Post or Delete methods. Let me try those.