Use Scweez in

Projects

We know what it's like on your end and so we have tied up all loose ends with our REST API Endpoint.
Be REST assured, we've got you covered.

Our endpoint is reliable and always online to service your needs. You may use our endpoint from the following languages:

  • JavaScript
  • PHP
  • Python
  • Node JS
  • Swift
API

Endpoint

API

Options

ACTION:

Defines the action to be performed by the API

action: 'shorten' | 'retrieve' | 'stats' | 'links';
NB: When using the stats or links action, additional authentication parameters are required.
URL:

Defines the url to be shortened by the API. The URL option is to be used with the shorten action.

action: 'shorten';
url: 'https://chromesque.com';
SLUG:

Defines the shortened slug. Please note that this is the extension on the domain name only. The slug option is to be used with the retrieve action.

action: 'retrieve';
slug: 'BDafeABa';
AUTH:

Defines the username of the entity to which information such as stats or links are being queried. It is required for authentication.

action: 'links';
auth: 'smiths';
token: '1234567890asdfghjkl';
TOKEN:

Defines an entity's authentication token.

action: 'stats';
auth: 'smiths';
token: '1234567890asdfghjkl';
API

Response

On sending a query to the API, the response is returned in JSON format and can then be used for your awesome purposes. An example of the expected result would be:


{
  short: "scweez.com/BDafeABa"
  status: "OK"
  url: "http://chromesque.com"
}
                        
API Usage

Examples

  • JavaScript
  • PHP
  •                             
    var xhr = new XMLHttpRequest();
    xhr.open("POST", 'https://api.chromesq.com/scweez/?action=shorten&url=https://chromesque.com', true);
    xhr.responseType = 'json';
    
    xhr.onreadystatechange = function() {
      if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        console.log(xhr.response);
      }
    }
    xhr.send();
                                
                              
  •                             
    $data = array("action"=>"retreive", "slug" => "BDafeABa");
    $url = "api.chromesq.com/scweez/";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    curl_close($curl);
    print_r($result);
                                
                              
  • Third Tab