Question: I have made a code in javascript/jquery which populates a division with tweets of a specific handle.

```
$.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+ handle + "&count=" + noOfTweets + "&include_rts=true&callback=?", function(data) {
    //some code
});

```

Here is the code to display the tweets

```
Json.parse(data);
$.each(data, function(i, tweet) {
  var buttonString = '<br/><a onclick="retweet('+tweet.id+')">Retweet</a>'
                            +'<a onclick="favorite('+tweet.id+')">Favorite</a>';

  $("#tweets").append($("<li/>").html(tweet.text+" <span class='tweetTime'>--a moment ago.</span>")+buttonString);
}

```

I now want to add retweet and favorite buttons to the tweets.
The twitter api for the above functions require a post request, but jquery doesn't have any .postJSON() function
<https://dev.twitter.com/docs/api/1/post/statuses/retweet/:id>
and
<https://dev.twitter.com/docs/api/1/post/favorites/create/:id>

so what should my retweet and favorite functions contain?
Some help please.

Answer: 
On the server side, your JSON API would be written in one language on one platform, this could be PHP, .NET or any platform of your choice.

On the client side (iPhone, Android, etc) You would need to write a client that is capable of making requests and handling responses to your JSON API.

However, in order to enforce consistency across your client API's you can employ a pattern, such as the request-reply pattern, I use this all the time as its easy to use and to implement.

The idea is for every JSON API method, you have a Request class, and a Response class. You would also write a service client that represents your JSON API. 

**An example**

Let's say I have a JSON service that gives me contact details from my address book, it could have these service methods:

```
/contact/{id}
/address_book
/save_contact/{id}

```

My service client (example in Java) could have this interface:

```
public interface AddressBookClient {
    public GetContactResponse getContact(GetContactRequest request);
    public GetAddressBookResponse getAddressBook(GetAddressBookRequest request);
    public SaveContactResponse saveContact(SaveContactRequest request);
}

```

Although the implementation would be different across client platforms, using the same approach or pattern would keep them consistent.

Hope that helps.
I would suggest something like a JSON based REST full API. 

This makes your API language independent.

Once the API is made then you can make client libraries in popular languages.