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.



To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. 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.

    (0) 
    1. Alessandro Iannacci 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?

      (0) 
      1. 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)

        (0) 
  2. ashwani tomar

    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

    (0) 

Leave a Reply