Getting Link Info

Get a long URL by domain name and a path of a short URL

πŸ“˜

Information below might be outdated - please visit our recently updated API Reference

The instruction below shows how to get the information about a link: original URL, date of creation, domainID, mobile URLs, expiration, cloaking...

  • Click "Create API key".
  • Add a Secret key.

2) Install prerequisites for requests.

pip install requests
npm install --save axios

Now everything is ready to run the following snippet. It will return info for a short link.

3) Create a file: filename.py/ .js/ .rb. Use the code snippet below.

πŸ“˜

Please, replace domain, path with appropriate values.

import requests

url = "https://api.short.io/links/expand"

querystring = {"domain":"short.xyz","path":"first-blog-post"}

headers = {
    'accept': "application/json",
    'authorization': "<<apiKey>>"
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
const axios = require('axios')

axios.get('https://api.short.io/links/expand', {
    params: {
        domain: 'short.xyz', 
        path: 'first-blog-post'
    },
    headers: {
        accept: 'application/json',
        authorization: '<<apiKey>>'
    }
  })
.then(function (response) {
  console.log(response.data);
})
.catch(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.short.io/links/expand?domain=short.xyz&path=first-blog-post")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = '<<apiKey>>'

response = http.request(request)
puts response.read_body

4) Launch the file.

python filename.py
node filename.js
ruby filename.rb

5) JSON Response (info for a link).

Once you run the code, you will see the response.

{
  id: 294526687,
  path: 'first-blog-post',
  title: null,
  icon: null,
  archived: false,
  originalURL: 'https://myyrbrand.wordpress.com/2017/12/26/first-blog-post/',
  iphoneURL: null,
  androidURL: null,
  splitURL: null,
  expiresAt: null,
  expiredURL: null,
  redirectType: null,
  cloaking: false,
  source: null,
  AutodeletedAt: null,
  createdAt: '2020-05-28T07:54:38.000Z',
  updatedAt: '2020-05-28T07:54:38.000Z',
  DomainId: 9026,
  OwnerId: 9346,
  tags: [],
  secureShortURL: 'https://short.xyz/first-blog-post',
  shortURL: 'https://short.xyz/first-blog-post'
}