Hi All,
This document will guide you how to use google URL hortener API in SAP.
1. Get the API key.
- Goto console.developers.google.com
- Click the URL Shortener API link.
- Create a project (skip if you already have)
- Create API Key (This server key will be used while consumption of service)
[Now you have the API key say: AIzaSyB_UdivSkXmuV85ytAZ59FWkXFF6uaaS2V]
- URL to consume: https://www.googleapis.com/urlshortener/v1/url?key=<API key>
2. Now we need to add Certificate in SAP as SAP assumes response is from non-trusted site.
- Get the *.cer file for above URL.
- Open the URL in Google chrome and click the lock image.
- Click the certificate Information link
- In the popup goto Details tab and click on 'copy to file' button.
- Specify file format and file name in the appeared wizard and generate *.cer file.
- Now you have Google API certificate file (say : GoogleUrlShortener.cer)
- Add the certificate to trusted list in SAP.
- Goto tcode: STRUST
- Choose SSL client SSL Client (Anonymo->Import certificate → Select *.cer file and click (OK)
- Now click Add to Certificate List
[Here Certificate has been added in SSL Client Anonymo whose SSL id is ANONYM ]
- Goto tcode: SMICM to restart ICM process.
3. Use Session ID: ANONYM while creating object of if_http_client.
[For sample code check the attached ZTEST_P.html file]
Thanks and regards,
Pramod Kumar Mandal.