Skip to content

A simple API Wrapper for the ecilA Link Shortener API (Hint: Since the 28th of September 2019, this service does not exist anymore.)

Notifications You must be signed in to change notification settings

Parou/ecilA-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

ecilA API PHP Wrapper

A simple API Wrapper for the ecilA Link Shortener API, written in PHP.
By Alice Peters

Basic usage:

include 'api.class.php';
$api		=	new  ecilaAPI('YourUsername',  'YourApiKey');
$request	=	$api->actionToPerform('Action');

You need an API key to be able to use the API. You can generate a new API key on your settings page.

Available actions:

Get data of an existing link:

$api->getLinkData('a1ic3');
// Or a custom link:
$api->getLinkData('l/a1ic3');

Example output:

array(2) { 
	["success"]=> 1 // 0 if an error ocurred
	["data"]=> { 
		["url"]=> "https://domain.tld/" // Original / target url
		["link"]=> "a1ic3" // Short link key
		["expire"]=> "0" // Expiration time in hours
		["time"]=> "1525987497" // Gets updated when the expiration time is set
		["timestamp"]=> "2018-05-10 23:24:57" // Creation date of the link
		["reported"]=> "0" // How many times the link was reported
		["moderated"]=> "0" // 1 if the link was previously approved by a moderator
		["private"]=> "0" // 1 if the link is not allowed to be displayed at the front page
	}
}

Add a new link:

$api->addLink('https://domain.tld/link-to-shorten/');

Example output:

array(2) { 
	["success"]=> 1 // 0 if an error ocurred
	["data"]=> { 
		["link"]=> "a1ic3" // Short link key (https://ecila.ga/a1ic3) 
		["code"]=> "Some simple code appears here" // Deletion code used to delete this short link later on
	}
}

Delete an existing link

$api->deleteLink('A deletion code that was returned by ecilaAPI::addLink();');

Example output:

array(1) {
	["success"]=> 1 // 0 if an error ocurred
}

Example error:

array(2) {
	["success"]=> 0
	["error"]=> "Some funny error message that tells you exactly what went wrong."
}

View ecila.ga

About

A simple API Wrapper for the ecilA Link Shortener API (Hint: Since the 28th of September 2019, this service does not exist anymore.)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages