Page MenuHomePhabricator

Use another URL shortener in Wikidata Query GUI
Closed, DuplicatePublic

Description is blocked to prevent spam in most Wikimedia wikis (including Wikidata) so it's not possible to link to a shortened query from Wikidata discussions.

How about storing the shortened queries in a database as part of the Wikidata Query Service (e.g. This could be extended to a public list of sample queries.

Event Timeline

nichtich created this task.May 27 2016, 9:07 PM
Restricted Application added projects: Wikidata, Discovery. · View Herald TranscriptMay 27 2016, 9:07 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript
Bhumika30 claimed this task.EditedMay 28 2016, 6:24 AM
Bhumika30 added a subscriber: Bhumika30.


Another option of can be is google's application.With the use of You can see how many people have clicked on your URL by visiting

It is easy to implement also:

  1. Visit the Google URL shortener site at
  2. If you aren’t signed in, click the Sign in button in the top right corner.
  3. Write or paste your URL in the Paste your long URL here box.
  4. Click Shorten URL.

Or we can integrate this API to any platform.

Below is script to use it with PHP:

Place your API Key,created from your account
Url to shorten
$longUrl = '';
$apiKey = 'Your Api key here';
You can get API key here : Login to google and
go to
Find API key under credentials under APIs & auth.
You will need to do necessary things to get key there. :)
Watch video below.

// * No need to modify any of the code line below. *
$postData = array('longUrl' => $longUrl, 'key' => $apiKey);
$jsonData = json_encode($postData);
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, ''.$apiKey);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json'));
curl_setopt($curlObj, CURLOPT_POST, 1);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData);
$response = curl_exec($curlObj);
$json = json_decode($response);

echo 'Shortened URL ->'.$json->id;

Bhumika Brahmbhatt