URL API Documentation

URL Link Shortener API by freebulksmsonline.com

Features

  • Generate or get existing short URLs, with sequential or custom keyword
  • Get some statistics about your links: top clicked links, least clicked links, newest links
  • Output format: JSON
  • Authentify using a secure passwordless mechanism (token)

Usage

You need to send parameters to https://freebulksmsonline.com/api/url-link-shortener/v1/ either via GET or POST
POST is prefferred (remember to URL-encode parameters if via GET). These parameters are:

  • A valid token (get from your my-account page on https://freebulksmsonline.com/my-account/)
  • The requested action: “shorturl” (get short URL for a link), “expand” (get long URL of a shorturl), “url-stats” (get stats about one short URL)

  • With action = “shorturl” :
    • the longurl to shorten
    • optional customurl and title for custom short URLs

  • With action = “expand” :
    • the shorturl to expand (can be either ‘abc’ or ‘https://mxk.pw/abc’)

  • With action = “url-stats” :
    • the shorturl for which to get stats (can be either ‘abc’ or ‘https://mxk.pw/abc’)

Sample requests

Example of a POST request with PHP to shorten a URL

<?php
$token = 'your_token';
$api_url =  'https://freebulksmsonline.com/api/url-link-shortener/v1/';

// Init the CURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HEADER, 0);            // No header in the result
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result
curl_setopt($ch, CURLOPT_POST, 1);              // This is a POST request
curl_setopt($ch, CURLOPT_POSTFIELDS, array(     // Data to POST
        'longurl' => 'https://freebulksmsonline.com',
        'action'   => 'shorturl',
        'token' => $token
    ));

// Fetch and return content
$data = curl_exec($ch);
curl_close($ch);

// Do something with the result. Here, we echo the long URL
$data = json_decode( $data );
echo $data->shorturl;
?>

Sample Returns

Sample return in JSON format for the shorturl action

{
  "keyword": "mypage",
  "longurl": "http:\/\/freebulksmsonline.com",
  "title": "Free Bulk SMS API",
  "created_at": "2014-10-24 16:01:39",
  "status": "success",
  "message": "http:\/\/freebulksmsonline.com added to database",
  "shorturl": "http:\/\/mxk.pw\/mypage",
  "statusCode": 200
}