API Documentation

Bit4.Me provides a RESTful API to allow consumption of our amazing services.

Our API is in Alpha so do not rely on it for critical services. Right now, the API does not require any API keys or other annoying authentication mechanism.

This will probably change, depending on abuse.

Everything we do is in JSON. Use it!

Contents

  1. LinkShrink API
    1. GET - Getting information about a shrunken link.
      1. Return Values
    2. POST - Create a new Short Link
      1. POST Parameters
      2. Return Values
  2. File Sharing
    1. GET - Getting information about a shared file
      1. Return Values
  3. API Error Returns
    1. HTTP Status Codes
  4. Semantic Versioning
  5. Postman Collection
  6. Comments

LinkShrink

GET - Getting information about a shrunken link

GET http://bit4.me/api/links/### Where ### is the link code.

Return Values

JSON Parameter JSON Contents Description
linkURL http://www.example.com/ The destination of the shortened link
linkCreated 2015-12-31 00:00:00 The time and date, in America/Chicago, that the link was shortened.
linkHits 15 A count of the times the link was navigated through to the long URL.
version 0.1.0 Bit4.Me API Version

POST - Create a new Short Link

POST http://bit4.me/api/links/

Post Parameters

POST Parameter Description
linkURL The link you want to condense

Return Values

Upon successful creation, a HTTP 201 Created response will be given, and a JSON response will be given.
JSON Parameter JSON Contents Description
link http://bit4me/l/?### The shortened link, with ### being where the code will be (of various length)
version 0.1.0 The current version of the Links API

File Sharing

GET - Getting information about a shared file

GET http://bit4.me/api/files/### Where ### is the file code.

Return Values

JSON Parameter JSON Contents Description
fileName bigbusiness.vcard The original, as uploaded, filename.
fileMime text/plain A guess as to the MIME type of the uploaded file.
fileSize 1234 File size, in bytes.
fileHash 2b61t7ade803258z864bz0ef2544ac76 An MD5 Hash of the file contents.
uploadDate 2015-12-31 00:00:00 The time and date the file was uploaded in America/Chicago time.
downloadCount 53 Times the file was downloaded.
lastDownloadDate 2015-12-31 00:00:00 The last time the file ws downloaded in America/Chicago time.
version 0.1.0 Bit4.Me API Version

Errors

The API may return errors at various times, and will always fit the following format:
JSON Parameter JSON Contents
error A textual description of what went wrong
errorcode HTTP Status Code of the page in question

Errors - HTTP Status Codes

Various status codes may be returned for errors:
HTTP Status Code Meaning
400 Bad Request -- Check how your request was presented and try again. Client Issue.
401 Unauthorized -- Make sure you authenticate or use your API key if the system requires it.
404 Not Found -- The resource you were looking for doesn't exist, or was deleted.
405 Method Not Allowed -- Most API endpoints use just GET and POST, and sometimes PUT and DELETE. Other methods simply are not supported. View the "Allow" header for more information on what is allowed.
500 Server Error -- Something went wrong on our end.

Semantic Versioning

The Bit4.Me API follows Semantic Versioning 2.0.0.

Postman Collection

You can download a copy of our Postman Collection. What's Postman? A awesome, free tool for working with RESTful APIs. Check it out.

Comments