Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 341
lcmp Avatar asked Oct 17 '22 14:10

lcmp


1 Answers

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.

like image 158
DaImTo Avatar answered Oct 21 '22 02:10

DaImTo