The good part about this integration is that you don’t need to do additional steps to register your application with the Service APIs, because in this case, the Google’s URL Shortener Service can be accessed “anonymously”, with out having the need to register the application and performing the authentication and authorization steps.
- Scribe-Java – A Java OAuth Library
- Google GSon – A JSON serialization/deserialization library in Java
Create a new project in IDE of your choice and add above downloaded JAR files to your project’s build/class path.
Compile and Run the project. You will notice an output similar to the one below in your IDE’s console:
Copy the Shortened URL, open a browser of your choice and paste the Shortened URL into the browser’s Address Bar and press ENTER. You will notice how Google’s URL Shortener Service resolves your Shortened URL to your original (longer) URL.
Original Longer URL resolved by Goo.gl: