Results 1 to 8 of 8
  1. #1
    kkid is offline Senior Member
    Join Date
    Jul 2012
    Posts
    245
    Rep Power
    8

    Default How do I go about using online APIs?

    I am looking to start using APIs which are available online such as the google maps API. However, I have no idea where to start and cannot find any decent online resources explaining how to do so with Java.

    From my understanding, an online API is simply a way to query a server to return relevant information in a structured format.

    So far, the closest I have came to using an API is typing:
    Java Code:
    http://api.github.com/users/ExampleUser
    into my web browser to retrieve GitHub user data.

    Is this how we interface with all/most API services, just via a URL? Or is this just an overly simplistic example?
    Even so, how would I go about using this example in Java specifically in a useful way?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: How do I go about using online APIs?

    If you're talking Javascript (not Java), have a look at this w3schools page: HTML5 Geolocation

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: How do I go about using online APIs?

    "online API" sounds like webservices. Modern web developers have a tendency to mislabel a RESTful webservice as an "API".
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: How do I go about using online APIs?

    Quote Originally Posted by gimbal2 View Post
    "online API" sounds like webservices. Modern web developers have a tendency to mislabel a RESTful webservice as an "API".
    Huh? No comprendo; please enlighten me (or maybe I need more coffee).

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: How do I go about using online APIs?

    You don't know what webservices are?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    kkid is offline Senior Member
    Join Date
    Jul 2012
    Posts
    245
    Rep Power
    8

    Default Re: How do I go about using online APIs?

    I have just researched the term "web service" and I think that may be the terminology I was meant to use. It is just that most places I look call such a service an API.

    In this case, how do I go about using web services such as the Google maps engine (Their distance matrix is specifically what I intend to use as I want to find distances between two locations in my program) in a Java program (it will actually be expressed in a Swing interface eventually).

    Is it as simple as sending a HTTP request in an output stream and getting the reply back from the server in an input stream? (At a basic level - I am after nothing complex, I am a beginner)

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: How do I go about using online APIs?

    Quote Originally Posted by gimbal2 View Post
    You don't know what webservices are?
    Yep, I think so, but why isn't it allowed to also call it an 'api'?

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: How do I go about using online APIs?

    Quote Originally Posted by kkid View Post
    I have just researched the term "web service" and I think that may be the terminology I was meant to use. It is just that most places I look call such a service an API.
    Good! But what is stopping you from researching "java webservice client" then?


    Quote Originally Posted by JosAH View Post
    Yep, I think so, but why isn't it allowed to also call it an 'api'?
    Well take this very thread as an example, researching "java API client" gives you incredibly irrelevant results.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. SMS Java APIs
    By a_turingmachine in forum Advanced Java
    Replies: 0
    Last Post: 08-12-2008, 04:33 AM
  2. Java APIs
    By chagla in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 10:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •