API version 1.1

Twishort API For Twitter apps


Having integrated the Twishort into your app, don't forget to contact us, so we can add you to our official Apps Page.
Twishort API Key
Posting via the Twishort API is limited to authorised applications.
Send us an email to obtain your Twishort API Key.

API Docs


Get Long Tweet

http://api.twishort.com/1.1/get.json?uri=cbbbc&api_key=xxxxx where cbbbc is uri of the post http://twishort.com/cbbbc and xxxxx is your API Key.

Note! If you want to get long tweet, your API Key must have read permissions. To obtain permissions please contact us. We only ask that you include a link back to Twishort when using get method.


Post Long Tweet

Description

Twishort API allows you to post data to the Twishort service before sending the post to Twitter.

It can be used by Twitter applications to post the long text to Twishort, and receive a tweet-sized message with a link to the complete post.

We use OAuth Echo to ensure valid requests. More about OAuth Echo at dev.twitter.com/pages/oauth_echo.

HTTP Method
POST
Available Formats
JSON
Resource URL
http://api.twishort.com/1.1/post.json
Headers

X-Auth-Service-Provider (required)

https://api.twitter.com/1.1/account/verify_credentials.json

X-Verify-Credentials-Authorization (required)

All the OAuth parameters necessary so it could call https://api.twitter.com/1.1/account/verify_credentials.json using OAuth in the HTTP header (e.g. it should look like OAuth oauth_consumer_key="...", oauth_token="...", oauth_signature_method="...", oauth_signature="...", oauth_timestamp="...", oauth_nonce="...", oauth_version="..." ).
Example
OAuth realm="http://api.twitter.com/",
oauth_consumer_key="GDdmIQH6jhtmLUypg82g",
oauth_signature_method="HMAC-SHA1",
oauth_token="819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw",
oauth_timestamp="1272325550",
oauth_nonce="oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y",
oauth_version="1.0",
oauth_signature="yOahq5m0YjDDjfjxHaXEsW9D%2BX0%3D"
Parameters

api_key (required)

Your Twishort API Key.

text (required)

Text to post.

media (optional)

If you add media=1 to the request, then text_to_tweet in response will be cut to a smaller number of characters, so you can add media link to your tweet.

Response

If you receive a 200 OK header, the text was posted successfully.
Example
200 OK
{
  "id":"cbbbc",
  "url":"http://twishort.com/cbbbc",
  "created_at":"Mon, 10 Dec 2012 12:07:28 +0000",
  "text_to_tweet":"text for the tweet… http://twishort.com/cbbbc",
  "user":
  {
    "id":835657794,
    "id_str":"835657794",
    "screen_name":"testuser"
  }
}
Error Response

In case of error you can recieve 400 Bad Request, 403 Forbidden, 404 Not Found, etc.
See the error description in the JSON body for more info.
Examples
403 Forbidden
{
  "errors":[
    {
      "message":"Invalid API Key",
      "code":131
    }
  ]
}
400 Bad Request
{
  "errors":[
    {
      "message":"Missing headers: No 'X-Verify-Credentials-Authorization' provided",
      "code":102
    },
    {
      "message":"Missing parameters: No 'api_key' provided",
      "code":111
    }
  ]
}

Update IDs

Once a message has been successfully posted to Twishort and Twitter, it would be really useful to send back the Twitter ID for the message. This will allow users to manage their Twishort posts and delete not only the Twishort post, but also the tweet associated with it. It will also makes replies much more effective.

URL

http://api.twishort.com/1.1/update_ids.json

Headers

The same as post.

Parameters

api_key (required)

Twishort API Key.

id (required)

id of the Twishort post (e.g. cbbbc).

tweet_id (required)

id of the tweet you've just posted to Twitter.

reply_to_tweet_id (optional)

in_reply_to_status_id of the tweet you've just posted to Twitter.

reply_to_user_id (optional)

in_reply_to_user_id of the tweet you've just posted to Twitter.

Examples

PHP Example on GitHub »
Old API

API version 1.0 (documentation from old site) is deprecated now. It will return 400 Bad Request.
We highly recommend update your code to API version 1.1 (this page).


Feel free to contact us if you have any questions.

Your Twitter Age »