Developers - Getting Started

Authentication headers

Each request to the TextUploader.com API must have an authentication header. To identify yourself, you send the following HTTP header with your API key (located in the TextUploader.com My Account page):

X-TextUploader-API-Key: your-api-key-here

The header name and value are case sensitive. Should you execute the request with wrong or missing headers, you will receive HTTP Response 401 (Unauthorized).

Your first request

The API exposes a simple method to determine the basic state and information on the TextUploader.com API. For example, utilizing CURL:

curl -X GET "http://api.textuploader.com/v1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-TextUploader-API-Key: your-api-key-here" \
-v \

Response:

{
    "errors": {
        "id": "",
        "status": "",
        "message": "",
        "info_url": ""
    },
    "results": {
        "apiVersion": "v1",
        "latestApiVersion": "v1",
        "status": "up",
        "documentation": "http://textuploader.com/developers"
    }
}

Message format

Currently TextUploader.com utilizes JSON to send and recieve messages. All posts to and from our API will be JSON encoded.

Error block

Each response will always return an error block in the JSON results. If an error is encountered, additional information about the error will be contained within that block.

{
    "errors": {
       "id": "",
       "status": "",
       "message": "",
       "info_url": ""
    },
    "results": [
       {}
    ]
}

RESTful

We've done our best to maintain a RESTful API. As such, the combination of url and http post verb make up the intention of your request. The follow list comprises what call signatures we support:

GET: /posts

This method will return the last 20 posts on the account.

POST: /posts

This will allow you to post to your account.

{
   "Title": "Sample Title",
   "Content": "Post body goes here.",
   "Type": "public"
}

Example:

curl -X POST "http://api.textuploader.com/v1/posts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-TextUploader-API-Key: your-api-key-here" \
-v \
-d '{"title": "Sample Title", "content": "Post body goes here.", "type": "public"}'

Response:

{
    "errors": {
        "id": "",
        "status": "",
        "message": "",
        "info_url": ""
    },
    "results": [
        {
            "shortcode": "d3j2",
              "shorturl": "http://txt.do/d3j2",
            "longurl": "http://textuploader.com/d3j2",
            "rawurl": "http://textuploader.com/d3j2/raw",
            "editurl": "https://textuploader.com/d3j2/edit",
            "title": "Sample Title",
            "content": "Post body goes here....",
            "revisions": 0,
            "type": "public",
            "expire": "",
            "hits": 0,
            "views": 0,
            "posted": 1380636792
        }
    ]
}
GET: /posts/[shortcode]

This method will return the complete body of the requested shortcode.

Table of Contents