What programming language do i need to know to use APIs?

hmeister

Regular Member
Joined
Jul 29, 2009
Messages
342
Reaction score
195
Hi,specifically...
I own a travel website and I want customer enquiries to go directly from my site to a number of hotel sites. I want those sites to 'talk' to my site and come back to the client whilst they are still online and confirm if they have availability or not and if so, take them through to a full booking form.

I know that finance companies do this with mortgages and insurance leads but I'm not sure how to do it. I am pretty good with html, css and a fair bit of PHP but I just don't get API's at all.

Can anyone point me in the right direction please? Thanks.
 
I think that if a website purpose an API he will purspose that in Php... Anothers languages too, but, anothers languages and not Php? Never seen...
 
I've just looked up my books for an answer as I don't know and am still learning. But apparently api calls are commonly coded in xml.

How it works is still a mystery to me but I will get there.

Hope it helps
 
Depends if the API is a series of transparent web requests (any language), or a binary blob/source code provided by the service (depends).
 
Like everyone above has said, there really is no specific language. Most APIs rely on HTTP Requests. With that said, most, if not all, programming languages can send HTTP requests (get, post, put, etc.). And on top of that, most programming languages have prebuilt libraries for HTTP requests. With libraries, you can send HTTP requests to an API in a few lines.

You mentioned you have a website that will be calling APIs. I'm assuming your site uses PHP. PHP is very easy to make calls from. You'll probably want to use a library just to make the coding a bit easier. You'll also have the APIs' responses parsed which will most likely be in XML.

Some popular APIs have their own libraries.

If you need any help or need to a more detailed explanation or maybe some links then just let me know. I'm not familiar with popular travel sites so I can't really give some sample code or find some links.
 
Thank you everyone even though I am none the wiser!
I will come back with a better response once I can digest what you have all said and also so that I can express exactly what it is I need.
 
If you want you can pm me your skype and we can talk about this in more detail. but as others have said it depends on the API, and the type of API it is. For instance if it is a RESTful based API then you would send a URL some parameters for whatever you are trying to accomplish, url?=information,whatever,is,cool and it would return with XML or JSON and you would have to parse that API, there are other types of api though. but usually if you want to interact with an web based API I would just try to do it in PHP or Ruby, as if its a bigger api there will be helper classes on github for pretty much everything. I mean I wrote a FFXIV: ARR HTML Parser that spit out information as JSON and pretty much "created" my own API for people to use. :P usually if there is an api people have used it and made classes to handle said api in any language you would want to use.
 
Since you know some PHP, it would be fairly easy to pick up a framework with REST functionality already incorporated. It will depend greatly on what API functionality the other hotel sites are offering, but it is usually straightforward. In fact, travelocity has an API section with tutorials and training so that you can use their API. I would take a look at it to get the basics down.
 
Back
Top