Anonymous URL Shortener

Welcome to the API

There isn't restrictions to use this API.

Create a link

Create a new link with a simple POST request:

$ curl -X POST https://api.sh4re.be/ \
   -d url="https://goo.gl/"

url parameter is required.

Success and Failure

Sample success:

{"success":true,"url":"https://sh4re.be/48"}

Sample failure:

{"success":false,"message":"Exceeded quota for this link."}

Usage

You may also use it in your project in JavaScript. The only requirement is url.

For example, to create a shorten link using default settings:

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    console.log(this.responseText);
  }
};
xhr.open('POST', 'https://api.sh4re.be/', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.send('url=' + url);

You can also supply a duration (valid choices are day, month, or year)

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    console.log(this.responseText);
  }
};
xhr.open('POST', 'https://api.sh4re.be/', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.send('url=' + url + '&duration=day');

Attributes

AttributeValueDescription
urlstringSpecifies the url
durationday
month
year
Specifies the duration of the link
once0
1
Specifies if you want to delete the link after the first use

Create a link for a file

Create a new link with a simple POST request:

$ curl -F 'file=@/home/petehouston/hello.txt' https://api.sh4re.be/

file parameter is required.

Example

For example, to create a link using custom settings:

var formData = new FormData();
formData.append('file', document.forms.f.file.files[0]);
formData.append('duration', 'year');
formData.append('once', '1');

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    console.log(this.responseText);
  }
};
xhr.open('POST', 'https://api.sh4re.be/', true);
xhr.send(formData);