EmCheio.com API

There is an API available in order to use the EmCheio.com service in a programatic way.

Getting started

All of the API methods return a data structure serialized with JSON:

{"status": {"msg": "MSG", "code": CODE}, "data": {···}}

The Methods

/api/shorten?url=x&hide_url=x

This method is used to generate a code for a given URL.

The input:

  • - url (string, required): the url to be shorten
  • - hide_url (bool, optional. default 0): if this variable is set to 1, the url will be hidden from the browser's address bar

The output:

"data": { "url": "http://www.theveryoriginalurl.com", "short_url": "X9y", "code": "X9y"}

CODE MSG
200
  • OK
500
  • NEED_INPUT (missing input variables)
  • INVALID_URL (invalid url format)
  • UNKNOWN_ERROR

/api/expand?code=x

This method is used to fetch an URL by code.

The input:

  • - code (string, required): search for an URL with this code

The output:

"data": { "url": "http://www.theveryoriginalurl.com", "short_url": "X9y", "code": "X9y"}

CODE MSG
200
  • OK
404
  • CODE_NOT_FOUND
500
  • NEED_INPUT (missing input variables)
  • UNKNOWN_ERROR

/api/requests?code=x

This method is used to retrieve the number of requests done to a specific URL (given a code).

The input:

  • - code (string, required): search for an URL with this code

The output:

"data": {"code": "X9y", "requests": "3362"}

CODE MSG
200
  • OK
404
  • CODE_NOT_FOUND
500
  • NEED_INPUT (missing input variables)
  • UNKNOWN_ERROR