Sign up now!

140Plus REST API Documentation

REST API Methods

HTTP Response Codes and Errors


140Plus REST API Method: postings/new

Create a new 140Plus Posting.

URL:

http://140plus.com/api/postings/new

HTTP Method(s):

GET, POST
Note: the http://140plus.com/api/postings/new service can accept GET parameters, POST parameters as application/x-www-form-urlencoded form data, or multipart/form-data. However, to included photos in the posting, multipart/form-data must be used.

Parameters:

  • api-key. Required. You can find your apiKey at http://140plus.com/acct/apikey
  • status. Required. Specifies the title of the post (this part is tweeted)
  • desc. Required. Specifies the body of the post - limited HTML allowed.
  • hash. Specifies the the optional category hashcode to place the post in.
  • imgfile1. multipart/form-data containing an image

Response:

<?xml version="1.0"?>
<posting>
  <request>/api/postings/new</request>
  <postid>hle4e</postid>
  <twurl>http://twitter.com/mrblog/status/10855278870269952</twurl>
  <desc>Chicago Cubs player and radio color man Ron Santo died yesterday at the age of 70. His love for the Cubs, baseball, and life was infectious and made him, without exaggeration, the best-loved man in Chicago. He will be sorely missed. </desc>
  <status>Chicago Cubs Legend Ron Santo Passes Away</status>
  <pubdate>Sat Dec 04 00:37:54 GMT 2010</pubdate>
  <hash>sports</hash>
  <imgurl1>http://onefortyplus.org/img/hle4e/Santo.jpg</imgurl1>
</posting>

Usage examples:

cURL:
curl -d "api-key=31148964-5azingg0a9&hash=science&status=NASA+discovers+new+form+of+life+in+toxic+US+lake&desc=The+bizarre+bacteria%2c+catchily+called+GFAJ%2d1%2c+was+discovered+in+the+toxic+waters+of+Mono+Lake+in+California+and+is+able+to+thrive+on+arsenic+%2d+and+incorporate+it+into+their+DNA%2e" http://140plus.com/api/postings/new
curl -F "api-key=31148964-5azingg0a9" -F "hash=sports" -F "status=Chicago Cubs Legend Ron Santo Passes Away" -F "desc=Chicago Cubs player and radio color man Ron Santo died yesterday at the age of 70. His love for the Cubs, baseball, and life was infectious and made him, without exaggeration, the best-loved man in Chicago. He will be sorely missed. " -F "imgfile1=@Santo.jpg;image/jpeg" http://140plus.com/api/postings/new


140Plus REST API Method: postings/show/{id}.format

Retrieve a 140Plus Posting.

URL:

http://140plus.com/api/postings/show/{id}.format

Supported formats:

xml, json

HTTP Method(s):

GET

Parameters:

  • id. Required. Id of the post to retrieve

Response:

{"posting": {
  "request": "/api/postings/show/LCISN.json",
  "postid": "LCISN",
  "desc": "An enterprising capitalist has turned a gag gift into an act of civil disobedience, selling Flying Pasties for air travelers who don't like revealing their private parts to TSA agents using back-scatter scanners.",
  "status": "Pasties Sold for Modest Air Travelers",
  "hash": "",
}}

Usage examples:

cURL:
curl http://140plus.com/api/postings/show/oW3EC
curl http://140plus.com/api/postings/show/5Edzq.json

HTTP Response Codes and Errors

HTTP Status Codes

The 140Plus API attempts to return appropriate HTTP status codes for every request.

  • 200 OK - Success
  • 400 Bad request - The request was invalid. An accompanying error message will explain why.
  • 401 Unauthorized - API Key was missing, incorrect, or invalid.
  • 403 Forbidden - The request is understood, but it has been refused. An accompanying error message will explain why.
  • 405 Method Not Allowed - The method specified in the request is not allowed for the resource identified by the request URI.
  • 410 Gone - The URI requested is invalid or the resource requested does not exist.
  • 500 Internal Server Error - Something is broken. Please contact us so the 140Plus team can investigate.

Error Messages

The 140Plus API returns error messages as appropriate. For example, an error might look like this:

<?xml version="1.0" encoding="UTF-8"?>
<posting>
  <request>/api/postings/show/SxTC4</request>
  <error>Invalid or expired posting</error>
</posting>