Skip to Content
Author's profile photo Alessandro Iannacci

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 🙂



1.1.PNG


1.2.PNG


2.PNG


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.



Assigned Tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Frank Koehntopp
      Frank Koehntopp

      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.

      Author's profile photo Alessandro Iannacci
      Alessandro Iannacci
      Blog Post Author

      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?

      Author's profile photo Frank Koehntopp
      Frank Koehntopp

      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)

      Author's profile photo Alessandro Iannacci
      Alessandro Iannacci
      Blog Post Author

      Thank you for the clarification Frank!

      Author's profile photo Praveer Sen
      Praveer Sen

      Good one..

      Author's profile photo Alessandro Iannacci
      Alessandro Iannacci
      Blog Post Author

      Thank you!

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Alessandro Iannacci
      Alessandro Iannacci
      Blog Post Author

      Hi you need to find on the Google website not on SCN 🙂

      URL Shortener   |   Google Developers

      Author's profile photo Former Member
      Former Member

      Thanks! I found it out on google site.