Using Google URL Shortener service via ABAP.
Sometimes you need to use short URL instead of the full URL. For example your URL in a table printed inside a PDF form with adobe livecycle, may be very very long, and sometimes is not so beautiful (or not working at all).
How to do that in ABAP?
There are different ways, as you can see from this great blog post from Ivan Femia
Anyway you may know, Google offer this service for free if you stay under the following limit:
1,000,000 requests/day
So… we all guys know Google as one of the best service providers in the world, why don’t we leverage this opportunity? 😉
Maybe you know this blog post: Integrating Google Glasses with SAP
As I explained there, the GOOGLE API ABAP CLIENT is already supporting Google Glasses, and has the same structure of the standard Google Php APIs, so I could add the support for the Google URL shortener service just adding few code lines and two abap classes!
And in just 1 hr, we got out functionality 🙂
If you have any other google services that may be useful for your business processes, just drop me an email and I will extend the framework, or join directly the project on GitHub here: Gh14Cc10/google-api-ABAP-client · GitHub
—-
To make the new functionality working, just clear (eventually) the table zgoogle_access (this is required because the requested access token has a different scope from the one requested with the google glasses demo report), and run the demo report ZGOOGLE_TEST_URLSHORTENER.
Nice integration work!
I would like to remark that you need to make sure the content of the URL does not disclose business critical information; all those links (and what they resolve to) will be available to Google and external entities that call them by accident.
Sometimes URLs contain user IDs, session tokens or other credentials.
Thank you Frank! And thank you for your hint!
I have a question: as I know, the list() method requires the oauth2 authentication. So external users should not be able to access the content. Am I wrong?
You're right - but brute forcing URLs might expose those (minor risk), but sending internal data to Google might be considered exposure on its own (in the case of handling customer data or credentials in those URLs)
Thank you for the clarification Frank!
Good one..
Thank you!
Hi Alessandro - Is there a sample code/ Documentation on Google URl Shortner services available? I didn't see any info on this on SAP website.
Thanks,
-Ashwani
Hi you need to find on the Google website not on SCN 🙂
URL Shortener   |   Google Developers
Thanks! I found it out on google site.