1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'General Programming Chat' started by hmeister, Sep 24, 2013.

  1. hmeister

    hmeister BANNED BANNED

    Joined:
    Jul 29, 2009
    Messages:
    342
    Likes Received:
    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.
     
  2. robertheise

    robertheise Newbie

    Joined:
    Jan 15, 2013
    Messages:
    17
    Likes Received:
    0
    it depends...if a specific language is supported
     
  3. WeBlack

    WeBlack BANNED BANNED

    Joined:
    Feb 11, 2012
    Messages:
    180
    Likes Received:
    66
    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...
     
    • Thanks Thanks x 1
  4. mazgalici

    mazgalici Supreme Member

    Joined:
    Jan 2, 2009
    Messages:
    1,489
    Likes Received:
    881
    Home Page:
    if is an API any language will work, that is the idea of an API
     
    • Thanks Thanks x 1
  5. rob1977

    rob1977 Power Member

    Joined:
    Mar 25, 2013
    Messages:
    773
    Likes Received:
    669
    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
     
    • Thanks Thanks x 1
  6. sm754

    sm754 Registered Member

    Joined:
    Mar 21, 2012
    Messages:
    93
    Likes Received:
    38
    Occupation:
    Farmer
    Location:
    Azerbaijan
    Depends if the API is a series of transparent web requests (any language), or a binary blob/source code provided by the service (depends).
     
    • Thanks Thanks x 1
  7. TheeAriGrande

    TheeAriGrande Regular Member

    Joined:
    Jul 14, 2013
    Messages:
    270
    Likes Received:
    151
    Location:
    Candlestick Park
    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.
     
    • Thanks Thanks x 1
  8. botrockets

    botrockets Regular Member

    Joined:
    Mar 16, 2013
    Messages:
    276
    Likes Received:
    468
    Occupation:
    Software Developer
    Location:
    Saint T.N.
    You need to know Javascript and Html, that's it !!
     
    • Thanks Thanks x 1
  9. hmeister

    hmeister BANNED BANNED

    Joined:
    Jul 29, 2009
    Messages:
    342
    Likes Received:
    195
    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.
     
  10. methylenebl

    methylenebl Newbie

    Joined:
    Aug 6, 2013
    Messages:
    22
    Likes Received:
    5
    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.
     
  11. aymenbnr

    aymenbnr Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 14, 2009
    Messages:
    206
    Likes Received:
    78
    Home Page:
    webclient in .NET can do this for you !
     
  12. goosefrabah

    goosefrabah Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 26, 2011
    Messages:
    429
    Likes Received:
    75
    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.