Shorten URLs

132 views
Skip to first unread message

Eric

unread,
Mar 18, 2015, 3:03:24 PM3/18/15
to tas...@googlegroups.com
Hello,

I'm trying to shorten URLs and I am not a developer if anyone has a suggestion that would be great. Here is the task I have so far:

Url Shorten (44)
A1: Variable Set [ Name:%url To:http://www.google.com/ Do Maths:Off Append:Off ]        (later the highlighted part will be %CLIP once I get it working)
A2: HTTP Post [ Server:Port:https://www.googleapis.com/urlshortener/v1/url Path: Data / File:{"longUrl": "%url"} Cookies: User Agent: Timeout:15 Content Type: Output File: Trust Any Certificate:On Continue Task After Error:On ]
A3: Flash [ Text:%HTTPR Long:Off ]
A4: Flash [ Text:%HTTPD Long:Off ]

I got my info from https://developers.google.com/url-shortener/v1/getting_started#shorten but I don't exactly know what I am reading. The response code I keep getting is 403. Or if you can tell me if I am even going at this the right way that would be helpful too.

Thanks.

Marta Hintz

unread,
Mar 18, 2015, 3:36:39 PM3/18/15
to tas...@googlegroups.com
I usually Google the error codes to find what they mean.

Mike Kreisher

unread,
Mar 20, 2015, 4:50:20 PM3/20/15
to tas...@googlegroups.com
I was having some issues trying to use Google's URL shortening api with Tasker Posts too. My issue was resolved in this reddit thread by someone suggesting to use RESTask

Robert Ryan

unread,
Mar 20, 2015, 10:49:23 PM3/20/15
to tas...@googlegroups.com
In order to send http posts to googleapis an api key or access key would have to be obtained. Have you done this?

In addition, you neglected to set the content type. It should be application/json'.

Robert Ryan

unread,
Mar 21, 2015, 1:13:35 PM3/21/15
to tas...@googlegroups.com
As an alternative, you could use the app 'goo.gl URL Shortener' and the Autoinput plug-in to automate this:

URL Short (27)
A1: Set Clipboard [ Text:https://groups.google.com/forum/m/#!topic/tasker/MsQPekC9fus Add:Off ]
A2: Launch App [ App:goo.gl URL Shortener Data: Exclude From Recent Apps:Off ]
A3: AutoInput Action [ Configuration:Type: Id
Value: com.mattiamaestrini.urlshortener:id/buttonInsertUrl
Action : Click Package:com.joaomgcd.autoinput Name:AutoInput Action Timeout (Seconds):20 ]
A4: AutoInput UI Query [ Configuration:Text: QR Code Package:com.joaomgcd.autoinput Name:AutoInput UI Query Timeout (Seconds):20 ]
A5: AutoInput Global Action [ Configuration:Action: Back Package:com.joaomgcd.autoinput Name:AutoInput Global Action Timeout (Seconds):20 ]

Cornelius Mostert

unread,
Aug 3, 2017, 6:49:15 AM8/3/17
to Tasker
Does anyone know how to include the API Key in the call?
Google API Doc state key=YourKey 

Cornelius Mostert

unread,
Aug 3, 2017, 8:39:33 AM8/3/17
to Tasker
I got it to work

  1. Read https://developers.google.com/url-shortener/v1/getting_started
  2. Get an API key from Google (see article)
  3. In Tasker
    • Use a HTTP Post
    • Read File Some_Location_On_Your_Phone/tempOut.txt into a variable
    • Split the Var untill you are happy

Reply all
Reply to author
Forward
0 new messages