aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes REST api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "REST api" Watch "REST api" New topic
Author

REST api

Joshua Elkino
Ranch Hand

Joined: Jul 24, 2007
Posts: 91
I've been searching the web but i cannot find a tutorial in how to call REST methods on a server.
Looking to integrate some geocoding and social network methods on my site. Anyone have any tip/tuts out there?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

Those "REST" methods are just plain old HTTP requests. Much simpler than other forms of web service. We are doing geocoding where I work, we send the address to Google and (usually) get latitude and longitude back buried in an XML document. We use the Apache HttpClient software to do that and there's about 25 lines of code.
Joshua Elkino
Ranch Hand

Joined: Jul 24, 2007
Posts: 91
Mind showing me an example? Are you using the javascript api? I want to do this on the server side since i dont trust js too much
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Accessing the Google Geocoder with Java is simple. Here is how to construct the URL.
Be aware that there's a throttle on how many requests you can make per minute (you'll get HTTP errors if you send too many) and per day (50000 if I remember correctly)


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Joshua Elkino
Ranch Hand

Joined: Jul 24, 2007
Posts: 91
Joe,
I'm quite aware of the JavaScript methods to use gMaps, but i'm looking for a server side (JAVA) equivalent, thus my inquiry for how to call REST methods.

Lets take OpenSocial API as another example.. it can be called using JS, REST, and RPC... http://code.google.com/apis/opensocial/docs/index.html
how would i use their API?
Joshua Elkino
Ranch Hand

Joined: Jul 24, 2007
Posts: 91
Well i finally found something simple!
http://developer.yahoo.com/java/howto-reqRestJava.html

Hope if anyone has a similar Q they can just look at this page for a simple example and modify it to work with their needs.
Joshua Elkino
Ranch Hand

Joined: Jul 24, 2007
Posts: 91
For a real example
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REST api