google-apigoogle-url-shortener

Google Url shortner API not loging Short link history with API key


I am using the Goo.gl API to shorten some links. The calls to the POST method are working good and the short URLs are working also, but I have a question regarding the short link history.

If I create a short url from the goo.gl page it will be stored there for me to see and see all the analytics associated to it, but if I generate it via the API POST using my API Key, the link will not be added to my history and I can't see any data related to it in the Goo.gl page. Is there anyway to access that information?


Solution

  • This is the difference between public and private.

    The Url Shortener API is technically a public API. Which means that you don't need to be Authenticated in order to use it. This is why a public API key works. However when you are using a public api key the api doesn't know who you are personally.

    Solution: What you need to do is to switch to Oauth2. Authenticate your application get an access token and instead of sending the API key send the access_token. Then when links are created they should be added to your account and you will get analytics for them.