Below are a few examples of developing with the BRAX API.
Retrieving a Single Item
brax.items.getItem( int item_id )
Retrieving a set of Items
brax.items.getItems( struct params )
The following params are supported:
|query||If query param is specified, it limits the returned results to those items that match the given query phrase. This is most often used in searches.|
|nick||The nick param limits the returned results to those items matching the given nick. This is used when you want to search by author.|
|tag||Only return results that have the specified tag word.|
|per_page||How many items to return.|
|page||Page number to return. By default, page 1 is returned.|
|channel||Limit results to a those originating from a particular channel. (such as channel #bor only)|
|domain||Limit results to a those originating from a particular domain name. (such as bordom.net)|
|type||Type of items to return (Eg: url, video, embed_video, image, photoset)|
|since||Return only items submitted since a specific date|
|until||Return only items submitted up until a specific date|
|public||Whether or not to return items that are not public (Ie: on the front page)|
Adding a New Item
brax.items.addItem( string user_token, string url, string title )
Below is an example of authenticating with BRAX (using the API username test and password testrpc, and submitting a new item.
require 'xmlrpc/client' server = XMLRPC::Client.new2("http://test:email@example.com/") server.call("brax.items.addUrlItem", "asx8u0JEduohwe9d8yweihudIUH", # user's token (see Auth section for info) "http://linuxbrit.co.uk/rbot/", # submitted url "Fancy new irc bot" # title (optional) )
Updating an Existing Item
brax.items.updateItem( int item_id, struct params )
brax.items.addTag( int item_id, string tag ) brax.items.deleteTag( int item_id, string tag )
Tag words may only contain certain characters. Namely, no punctuation or extended (unsafe) characters are accepted in a tag word. Tag words are stripped of all non-alphanumeric characters - however spaces ARE allowed.
brax.items.addComment( int item_id, string user_token, string comment ) brax.comments.deleteComment( int comment_id ) brax.comments.getComment( int comment_id )
For a full list of method calls (uses real-time API reflection), see API Methods.