about > api

Twitmart REST API Documentation

REST API Methods

HTTP Response Codes and Errors


Twitmart REST API Method: postings/show

Returns a single Twitmart Posting, specified by the id parameter below.

URL:

http://twitmart.org/api/postings/show/{id}

HTTP Method(s):

GET

Parameters:

  • id. Required. The Posting ID of the Posting to retrieve.
    • Example: http://twitmart.org/api/postings/show/SxTCn

Response:

<posting>
  <request>/api/postings/show/SxTCn</request>
  <postid>SxTCn</postid>
  <twurl>http://twitter.com/jimialfaro/status/5110037398</twurl>
  <desc>I want to transfer the remainder of my contract over to someone else. I no longer need my Verizon Wireless card as I have changed jobs and no longer travel.&#xd;
&#xd;
Throwing the PC Card in for free as an incentive. </desc>
  <status>Verizon Wireless PC5750 PC Card Contract 4 Sale</status>
  <pubdate>2009-10-23 16:34:34.861 PDT</pubdate>
  <locname>San Francisco, CA</locname>
  <hash>forsale</hash>
  <views>2</views>
  <imgurl1>http://twitmart.org/img/SxTCn/vzw_pc5750_card.png</imgurl1>
</posting>

Usage examples:

cURL:
curl http://twitmart.org/api/postings/show/FNG3f

Twitmart REST API Method: postings/new

Create a new Twitmart Posting.

URL:

http://twitmart.org/api/postings/new

HTTP Method(s):

GET, POST

Note: the http://twitmart.org/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://twitmart.org/acct/apikey
  • hash. Required. Specifies the category hashcode to place the post (ad) in.
  • status. Required. Specifies the short status-line for the post (this part is tweeted)
  • desc. Specifies additional extra text for the post.
  • location. Specifies a location.
  • imgfile1. multipart/form-data containing an image
  • imgfile2. multipart/form-data containing an image
  • imgfile3. multipart/form-data containing an image
  • imgfile4. multipart/form-data containing an image

Response:

<posting>
  <request>/api/postings/new</request>
  <postid>SxTCn</postid>
  <twurl>http://twitter.com/jimialfaro/status/5110037398</twurl>
  <desc>I want to transfer the remainder of my contract over to someone else. I no longer need my Verizon Wireless card as I have changed jobs and no longer travel.&#xd;
&#xd;
Throwing the PC Card in for free as an incentive. </desc>
  <status>Verizon Wireless PC5750 PC Card Contract 4 Sale</status>
  <pubdate>2009-10-23 16:34:34.861 PDT</pubdate>
  <locname>San Francisco, CA</locname>
  <hash>forsale</hash>
  <views>2</views>
  <imgurl1>http://twitmart.org/img/SxTCn/vzw_pc5750_card.png</imgurl1>
</posting>

Usage examples:

cURL:
curl -d "api-key=31148964-5azingg0a9&hash=forsale&status=Maytag+Washer+%28Austin%29+%24150&desc=5+years+old+like+new+condition&location=Austin,+TX" http://twitmart.org/api/postings/new
curl -F "api-key=31148964-5azingg0a9" -F "hash=forsale" -F "status=Maytag Washer (Austin) $150" -F "desc=5 years old like new condition" -F "location=Austin, TX" -F "imgfile1=@washer.jpg;image/jpeg" http://twitmart.org/api/postings/new

HTTP Response Codes and Errors

HTTP Status Codes

The Twitmart 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 Twitmart team can investigate.

Error Messages

The Twitmart 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>

<< back to main Twitmart help