Developers > Reference guide to the REST API (advanced)

Reference guide to the REST API (advanced)

Introduction

LikeOrHate.com provides a REST-like API for those who want to customize results, build mash-ups and so on.

You probably don't want to read this page: we also provide a set of libraries in several languages, which are much, much simpler to use. Most people don't need to know about the REST internals, described in this page; they can just use those libraries.

This documentation covers the version 1.1beta1 of the API and was last updated on March 1, 2010, 2:05 pm. Changes may occur to final 1.1 release, expected for March 15.

Overview

Have you read this important information before anything else?

Important facts you have to know:

  • Everything is encoded in UTF-8. Requests must be in utf-8.
  • Althouth we use http://sandbox.likeorhate.com as the base URI, that is only a sandbox. Use the main site URI when you deploy your code.
  • Everything stored in LikeOrHate.com is a thing. Things can be subtyped. In OO-terms, Thing is a parent class which may be inherited by subclasses. So users, lists and comments are things too. This means you can use thing/ requests with users, lists etc. The opposite is not true, of course (that is, not all things are comments, but all comments are things).
  • Prefer numeric ids to string labels. We suggest you query basic information with the label, using disambiguation information to make sure you got the right thing, and then use only ids in subsequent requests. Ids are permanent, you can safely use them in your own database.
  • We limit the number requests per hour per IP. Check the current limits.

All requests are GET or POST. Methods that submit, change, or destroy data require a POST, except for thing-rate, which is a write operation which accepts both POST and GET. We return HTTP codes according to the status of the request:

200 OK
your request was perfect. We are glad to serve you data.
400 Bad Request
your request was invalid. See the 'message' field to know what was wrong with it.
401 Not Authorized
authentication was needed and either you didn't provide one or it was invalid.
403 Forbidden
you have no permission for that request. 401 is returned when authentication fails, while 403 is returned when authentication was ok but you still have no permission for that request (for example, some user set his data as private or you are trying to modify data that does not belong to you).
500 Internal Server Error
damn, something went wrong in our servers. Please tell us about it.
509 Bandwidth Limit Exceeded
dude, you blew your hourly limits. Wait for a few hours and we'll clear up your access. And don't run those bad scripts anymore, ok?

REST URLs are in the following format:

http://likeorhate.com/rest/[service]/[function]/?[parameters]

Where:

[service]
This is the object you're seeking information on. Possible values currently are: thing, user, comment, list, message, search, sparql, and zeitgeist.
[function]
Which function of the service you want to run. See the documentation for each service for a list of available functions.
[parameters]
Each function has its own parameters, but some of the parameters are global. GET parameters are ignored in POST requests, and vice-versa.

Global parameters

Some parameters are valid (but not necessarily meaningful) for all queries, unless otherwise noted. They are:

responseType
Default is "XML". Read more about available types.
language
Language for the request, according to BCP 47 (that is, RFC4646 and RFC4747, using Language Subtag Registry from IANA) format (examples: "en", "en-us"). In write requests, sets the language for the data being sent, although it can be overriden by other parameters. In read requests, only entries matching that language will be returned (if not set all languages are used).
jsonvarout
Used only when the responseType is JSON (or a JSON variant). See below.
jsoncallback
Used only when the responseType is JSON (or a JSON variant). See below.

These parameters are available for any request with a query that returns a many items:

total
Integer, number of items returned per page. Default: 25. Maximum: 1000.
begin
Integer, result index to start at. First index is 0. Default: 0.
sort
Index to sort by. The available indices are listed at each function.

Response type

We support several formats for the response, to make life easier for the developer. Some notes particular to each response type:

XML
UTF-8 encoded. We try to follow namespaces for popular ontologies whenever we can. Contents of nodes are escaped, so you should unescape them (although any decent XML reader should do this by default). The base node is <likeorhate>, with the following attributes:
version
The API version. Equal major numbers (e.g. 1.0, 1.1, 1.2) are completely backward compatible, but different major numbers (1.0, 2.0) may introduce incompatibilities.
status
The return status. Boolean value: false means something was wrong in your request, true means it was ok.
message
String explaining what went wrong, if status==false.
HTML
This is the very HTML we use in our own website and gadgets, so it may suffer small changes from time to time, and even some big ones every now and then. It's CSS-styled, so you can configure its look.
You should include the http://sandbox.likeorhate.com/css/loh_site.css stylesheet (or roll your own), and some HTML code depends on our javascripts too, so you should load http://sandbox.likeorhate.com/js/likeorhate.js.
We strongly suggest that you do not use HTML format in write requests, since you are not always able to tell if the request was successful or not; use JSONHTML instead.
We may drop support for HTML in write requests in the future, so you are warned.
JSON
JSON format. Use parameter "jsonvarout" to set the return variable. That is, if jsonvarout=foo, we output something like var foo = {};. If you prefer to have a callback called instead of a variable set, use instead the parameter "jsoncallback": if jsoncallback=foo, we output something like foo();. Both jsonvarout and jsoncallback must validate against ^([a-zA-Z0-9\-_]*)$.
JSONXML
Same as XML, but wrapped in JSONP, so it can used in cross-site requests of javascript. Use parameter "jsonvarout" to set your callback.
JSONHTML
Same as HTML, but wrapped in JSONP, so it can used in cross-site requests of javascript. Use parameter "jsonvarout" to set your callback.
PHP
PHP serialization format. NOTE: since it is more practical and interesting, we present in the examples of this documentation the data AFTER it's run through unserialize()!!! When you receive the raw data from the REST response, you have to call unserialize() to parse it and get the results presented here.
YAML
YAML serialization format.

This documentation shows the response for several of the formats above. Note that there may be small differences in the documentation from one format to another: for example, requests which create things will have differing ids for each of the responses, since we made separate requests to generate the output. With the exception of HTML and JSONHTML, all the other formats should output the same information.

Data types and formats

Integer/unsigned integer
32-bit integer.
Float
32-bit float.
Date
Always in 'YYYY-MM-DD'.
Time
Always in 'HH:MM:SS'.
Datetime
Always in 'YYYY-MM-DD HH:MM:SS'.
String
In UTF-8, up to 256 characters (not bytes) long.
Text
In UTF-8, up to 16384 characters (not bytes) long, but this length may increase in the future.
HTML
In UTF-8, up to 16384 characters (not bytes) long, counting tags, but this length may increase in the future.
URI
A valid URI/URL. It will be normalized.
Array
An array. In an HTTP query, this looks like "item[]=1&item[]=2". In responses, arrays in XML are delimited by an outer tag, usually the <items> tag (which may have a total attribute with the total items in the list (which may be larger than the items actually rendered)). If the <items> tag is used, individual items will be grouped by a <item> tag. Example:
<items total="30">
	<item>
		something
	</item>
	<item>
		something2
	</item>
</items>
List
A comma-delimited list of strings
Fields
Lists the fields that should be returned by the request. This is used by requests that list many attributes, such as thing/editable/ and search/condition/. This array must be JSON-encoded and is an associative array. This array associates the field name to extra parameters that control its appearance (these extra parameters are listed in each command that supports fields). Here are examples in many languages of the associative arrays (but REMEMBER, only JSON is accepted by the REST API!):
{"field1":{"value":"value field1","required":true},"field2":{"value":"value field1","comment":"Some comment"}}

Authentication

Many requests require authentication, in particular write requests and access to private data. We currently support these authentication schemes:

HTTP Basic Authentication
You should know about it. This is what you want to use if you want to access data only for your own user.
Session cookies based authentication
Session cookies, created by a site login, are also accepted. The REST interface does not provide a cookie login service by itself. This is more useful for JavaScript.
OAuth
OAuth is a common standard and may be used to access LikeOrHate by third parties on behalf of other users, securely (three-legged OAuth). You need to register your application before you can use it. This is what you want if your site will use LikeOrHate as a backend and you support user logins.

If you are using the REST API you must register for a LikeOrHate user account using a local login, because we do not support login through external sites, as we do in the website. Of course, regular users which are redirected to LikeOrHate through OAuth will be able to login through external sites.

Grants

When accessing via OAuth, there are some fine-grained grant levels that the user may use to control what the application can or cannot access. When you make an OAuth request, the user will login and then agree or disagree with the list of grants that you have selected.

read
read things
create
create things
rate
rate things
update
update things (attributes)
delete
delete things
comment
create comment
media
create/add media to an existing thing
readMessage
read private messages (inbox, outbox)
writeMessage
post private messages on user behalf
readUser
read user profile
writeUser
write user profile

Request reference

Thing command

This is the basic command to get information on the thing. Here you get its id, rating, comments and more. Functions for the 'thing' command:

base
Basic data about the thing (overall ratings, statistics). Read-only
information
Information about the thing. Read-only.
comment
Get comments. Read-only.
rate
Thing rating. Write-only.
related
List of related things. Read-only.
trackback
List of trackbacks. Read-only.
create
Create a new thing. Write-only.
setdata
Sets or adds data (such as labels, media, etc) for a thing. Write-only.
editable
Renders an editable interface to create or edit a thing. Read-only.

The functions base, information, comment, related, trackback support multiple things in the same request, so you can use arrays:

label[]
Array. May be present one or more times. Each one is a label of a thing to be returned. '_' in labels which are not URIs are converted to spaces before searching.
Search may return many possible things for a given label. In this case the best match is returned, with a list of disambiguation possibilities.
id[]
Array. May be present one or more times. Each one is the internal id used by LikeOrHate for a thing. Internal ids are handy (no way to mistake two things which have the same or similar labels) but not user friendly. You should prefer ids to labels whenever possible. Ids never change (labels may), are faster and less error-prone.

thing/base: Basic data

This is the basic operation on LikeOrHate.com, which returns information on a given thing. What is returned:

id
Integer. Used as a unique identifier for each thing. -1 means not found.
querylabel
String. The string label you sent as request, which may be somewhat different than the returned labels (for example, case may mismatch).
link
URI. Link to this thing's page in LikeOrHate.com.
thumb
URI. A thumbnail, if it exists.
created
Datetime. Datetime when this thing was created.
updated
Datetime. Last datetime it was updated.
like
Unsigned integer. Number of "I like it" votes. Two other attributes may exist: float percent, with the percentage of votes calculated for you, and float barwidth, which is used for the colored vote bars on LikeOrHate.com.
hate
Integer. Number of "I hate it" votes. See like.
whatever
Integer. Number of "Whatever" votes. See like.
average
Float. A floating point grade for this thing, calculated from the votes. 0 <= score <= 1, higher is more liked, smaller is more hated, 0.5 is whatever.
statistics
Some statistics on this thing: comment is the number of comments, trackbackhits is the number of hits it got, trackbackurl is the number of different URLs which has so far linked to it, related the number of related things.
disamb
A list of possible disambiguations for this querylabel; the id attribute gives the thing id.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/base/?label[]=likeorhate.com:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <items>
        <item>
            <thing>
                <id>9</id>
                <querylabel>likeorhate.com</querylabel>
                <label xml:lang="en">LikeOrHate.com</label>
                <link href="http://sandbox.likeorhate.com/thing/9/" rel="self" />
                <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
                <created>2010-03-01 14:04:37</created>
                <updated>2010-03-01 14:04:37</updated>
                <like barwidth="70" percent="100.0">1</like>
                <whatever barwidth="0" percent="0.0">0</whatever>
                <hate barwidth="0" percent="0.0">0</hate>
                <average>0.640449438202247</average>
                <statistics comment="2" related="" tbrating="0" trackbackhits="0" trackbackurl="0" />
                <disamb>
                    <item id="9">LikeOrHate.com</item>
                </disamb>
            </thing>
        </item>
    </items>
</likeorhate>
 

thing/comment: Comments

This returns comments made on the thing. What is returned for each comment:

id
Integer. Used as a unique identifier for each comment.
guid
URI. This is the unique URI to this comment.
thing
Unsigned integer. The id of the thing this comment is about.
parent
Integer. Parent comment (if this is a reply). If no parent, then 0.
replies
Unsigned integer. Number of replies this comment has.
author
String. Author name. May be used to query users.
authorLink
URI. The author page in LikeOrHate.com.
authorRate
String. The rate (like, hate, whatever) given by the author to the thing this comment is about. May be null.
pubDate
Datetime the comment was published.
title
String. Comment title. May be null.
message
HTML. Message body. May contain (safe) HTML.
from
URI. Page from which this comment was posted from.
link
URI. This comment's link.
created
Datetime the comment was created.
update
Datetime the comment was last updated.
like
Unsigned integer. Number of like votes for this comment.
whatever
Unsigned integer. Number of whatever votes for this comment.
hate
Unsigned integer. Number of hate votes for this comment.
average
Float. Vote score.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/comment/?label[]=likeorhate.com:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <thing>
        <id>9</id>
        <comments>
            <item count="1" xml:lang="en">
                <guid>http://sandbox.likeorhate.com/comment/11</guid>
                <id>11</id>
                <thing>9</thing>
                <parent>0</parent>
                <replies>0</replies>
                <author>likeorhate</author>
                <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
                <authorRate>like</authorRate>
                <pubDate>2010-03-01 14:04:37</pubDate>
                <title>Outra mensagem de teste</title>
                <message>&lt;p&gt;&lt;b&gt;Ainda&lt;/b&gt; o melhor site do mundo!&lt;/p&gt;</message>
                <from />
                <link href="http://sandbox.likeorhate.com/comment/11" rel="self" />
                <created>2010-03-01 14:04:37</created>
                <updated>2010-03-01 14:04:37</updated>
                <like>0</like>
                <whatever>0</whatever>
                <hate>0</hate>
                <average>0.5</average>
            </item>
            <item count="2" xml:lang="en">
                <guid>http://sandbox.likeorhate.com/comment/10</guid>
                <id>10</id>
                <thing>9</thing>
                <parent>0</parent>
                <replies>0</replies>
                <author>likeorhate</author>
                <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
                <authorRate>like</authorRate>
                <pubDate>2010-03-01 14:04:37</pubDate>
                <title>Test message</title>
                <message>&lt;p&gt;&lt;b&gt;Best&lt;/b&gt; site ever!&lt;/p&gt;</message>
                <from />
                <link href="http://sandbox.likeorhate.com/comment/10" rel="self" />
                <created>2010-03-01 14:04:37</created>
                <updated>2010-03-01 14:04:37</updated>
                <like>0</like>
                <whatever>0</whatever>
                <hate>0</hate>
                <average>0.5</average>
            </item>
        </comments>
    </thing>
</likeorhate>
 

thing/information: Extended data

NOTE: THE RESPONSE FOR THIS COMMAND IS CURRENTLY UNSTABLE. It may be changed without further notice. Extended information about this thing. This will be continously extended with new information (keeping backward compatibility) and should follow common RDF ontologies as close as possible. Information currently includes:

labels
Composite. Alternate labels for this thing, with the corresponding language if available.
lists
Composite. Lists this thing belongs to.
descriptions
Composite. A short description of this thing, with the corresponding language if available.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/information/?label[]=likeorhate.com:

<likeorhate message="Thing does not exist" status="false" version="1.1" />
 

thing/rate: Rate (write-only)

Rate command. This command is write-only, and used to add a new rating to the thing. It accepts both GET and POST requests (which makes life easier for third party sites to get around AJAX restrictions). Parameters:

id
Integer. Thing id.
rate
String. One of these strings: "like", "whatever", "rate". Case sensitive.

Information similar to thing/base is returned.

Here's an example for the query (id=1, rate=like):

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <thing>
        <id>1</id>
        <querylabel>1</querylabel>
        <label xml:lang="">likeorhate</label>
        <link href="http://sandbox.likeorhate.com/user/likeorhate/" rel="self" />
        <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
        <created>2010-03-01 14:04:36</created>
        <updated>2010-03-01 14:04:36</updated>
        <like barwidth="70" percent="100.0">1</like>
        <whatever barwidth="0" percent="0.0">0</whatever>
        <hate barwidth="0" percent="0.0">0</hate>
        <average>0.640449438202247</average>
        <statistics comment="0" related="" tbrating="0" trackbackhits="0" trackbackurl="0" />
    </thing>
</likeorhate>
 

Related things. Other things which are related to this one.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/related/:

thing/create: Create thing

Creates a new basic thing; that is, this command should not be used to create comments, users or lists. Remember, this must be a POST request. These are the required parameters:

loh:label
String. Thing label. If you want to add more than one label, see setdata.
loh:language
String. Language code for label and description.
loh:summary
String. Summary (up to 255 chars). Optional, but highly recommended.

Besides these mandatory fields, you may also use any of the supported attribute fields. Note that you must prefix these attribute fields (i.e., anything in your query that is in this list) with "loh:", which enables you to mix your own data in HTML forms and quickly filter them out. Fields which are not attributes (such as responseType) should not be prefixed with "loh:". Also note that the code libraries already do this prefixing for you automatically.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/create/:

<likeorhate message="" status="true" version="1.1">
    <thing>
        <id>20</id>
    </thing>
</likeorhate>
 

thing/editable

This command provides easy to use functionality to access the LikeOrHate database, returning data already formatted, editable forms and more. It's much higher level compared to the other commands. As of this writing, only the HTML responseType is implemented, as others don't make sense. JSONHTML will be supported in the future.

The HTML code is ready to be put into a <form> tag (the form tag is not sent in the output) and posted to LikeOrHate REST services. If you want to add your own fields, you can also do that. This function also automatically adds the "loh:" prefix as required, so you don't have to worry about that either. We append some Javascript to the code, which handles validation and other things and which requires you to include <script type="text/javascript" src="http://likeorhate.com/js/likeorhate.js"></script> to your HTML source code.

Renders an editable form with the chosen fields for a given thing, filling default values. You may use the thing parameter id=0 to render an empty editable form, which can be used to create new things.

This command uses the a parameter fields (explained here) to select the data to be rendered. Valid field parameters:

value
Default value for this field. Default: null.
comment
String. A comment explaining this field.
required
Boolean. Whether this field must be filled. Default: false.
hidden
Whether this field should not be shown. The thing id is returned hidden by default if the thing exists.

Since there's a limit to the length of HTTP GET requests that can be easily overriden with a long fields parameter, this command also responds to POST requests, even though it is read-only.

Here's an example for the query: http://sandbox.likeorhate.com/rest/thing/editable

 

 

File Logo
 

 

 

PlaceOptional, your address
 

 

 

 

 

 

 

ContactContact information.
 

 

 

 

thing/setdata: Add or change data of a thing

Under implementation.

User command

Functions for the user command return what was made by the user. For example, if you want the comments written by a user, you should call /rest/user/comments/?id=xx, but if you want comments about a user, you should call /rest/thing/comments/?id=xx. Remember that users are things as well, so all thing functions work for users as well, although the permissions are more restrictive.

Users can choose to have some of their data as private, or accessible only by friends. In this case you'll have to be logged in to be able to access the data and also to have permission from the user to do so. See also the grants section.

Functions for the 'user' command:

profile
Profile information for the user. Read-write.
rating
Ratings made by the user. Read-only.
friends
Relations (friends, etc) for the user. Read-only.
comment
Comments written by the user. Read-only.
recommendation
Thing recommendations for the user. Read-only.
editable
Not implemented yet. Read-only.

user/profile

Profile information for the user. We mainly follow FOAF, but sometime soon we'll also implement opensocial.Person.

Here's an example for the query: http://sandbox.likeorhate.com/rest/user/profile/?username=likeorhate:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <foaf:Person rdf:about="http://sandbox.likeorhate.com/user/likeorhate/" xmlns:foaf="http://xmlns.com/foaf/0.1/">
        <foaf:holdsAccount>
            <foaf:OnlineAccount>
                <foaf:accountProfilePage dc:title="LikeOrHate" rdf:resource="http://sandbox.likeorhate.com/user/likeorhate/" />
                <foaf:accountServiceHomepage dc:title="LikeOrHate" rdf:resource="http://sandbox.likeorhate.com" />
                <foaf:accountName>likeorhate</foaf:accountName>
            </foaf:OnlineAccount>
        </foaf:holdsAccount>
        <foaf:name>LikeOrHate</foaf:name>
        <foaf:theme />
        <foaf:gender>0</foaf:gender>
        <foaf:title>Website</foaf:title>
        <foaf:nick>LoH</foaf:nick>
        <foaf:img rdf:resource="" />
        <foaf:homepage rdf:resource="http://sandbox.likeorhate.com/" />
        <foaf:weblog rdf:resource="http://sandbox.likeorhate.com/" />
        <foaf:workplaceHomepage rdf:resource="http://sandbox.likeorhate.com/" />
    </foaf:Person>
    <osoc:Person rdf:about="http://sandbox.likeorhate.com/user/likeorhate/" xmlns="http://ns.opensocial.org/2008/opensocial" />
</likeorhate>
 

user/rating

Ratings that this user has made. These are not ratings for the user, which are accessed with thing/rate, but ratings by the user.

Here's an example for the query: http://sandbox.likeorhate.com/rest/user/rating/?username=likeorhate:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <items total="3">
        <item>
            <id>9</id>
            <rate>like</rate>
        </item>
        <item>
            <id>12</id>
            <rate>whatever</rate>
        </item>
        <item>
            <id>13</id>
            <rate>like</rate>
        </item>
    </items>
</likeorhate>
 

user/friends

Returns friendship information (using XFN).

Here's an example for the query: http://sandbox.likeorhate.com/rest/user/friends/?username=likeorhate:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <items>
        <item id="2">
            <xfn:friend rdf:resource="http://sandbox.likeorhate.com/user/?id=2" />
            <xfn:co-worker rdf:resource="http://sandbox.likeorhate.com/user/?id=2" />
            <xfn:neighbor rdf:resource="http://sandbox.likeorhate.com/user/?id=2" />
        </item>
    </items>
</likeorhate>
 

user/comment

This returns comments written by the user.

Here's an example for the query: http://sandbox.likeorhate.com/rest/user/comment/?username=likeorhate:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <thing>
        <id>1</id>
        <comments>
            <item count="1" xml:lang="en">
                <guid>http://sandbox.likeorhate.com/comment/11</guid>
                <id>11</id>
                <thing>9</thing>
                <parent>0</parent>
                <replies>0</replies>
                <author>likeorhate</author>
                <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
                <authorRate>like</authorRate>
                <pubDate>2010-03-01 14:04:37</pubDate>
                <title>Outra mensagem de teste</title>
                <message>&lt;p&gt;&lt;b&gt;Ainda&lt;/b&gt; o melhor site do mundo!&lt;/p&gt;</message>
                <from />
                <link href="http://sandbox.likeorhate.com/comment/11" rel="self" />
                <created>2010-03-01 14:04:37</created>
                <updated>2010-03-01 14:04:37</updated>
                <like>0</like>
                <whatever>0</whatever>
                <hate>0</hate>
                <average>0.5</average>
            </item>
            <item count="2" xml:lang="en">
                <guid>http://sandbox.likeorhate.com/comment/10</guid>
                <id>10</id>
                <thing>9</thing>
                <parent>0</parent>
                <replies>0</replies>
                <author>likeorhate</author>
                <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
                <authorRate>like</authorRate>
                <pubDate>2010-03-01 14:04:37</pubDate>
                <title>Test message</title>
                <message>&lt;p&gt;&lt;b&gt;Best&lt;/b&gt; site ever!&lt;/p&gt;</message>
                <from />
                <link href="http://sandbox.likeorhate.com/comment/10" rel="self" />
                <created>2010-03-01 14:04:37</created>
                <updated>2010-03-01 14:04:37</updated>
                <like>0</like>
                <whatever>0</whatever>
                <hate>0</hate>
                <average>0.5</average>
            </item>
        </comments>
    </thing>
</likeorhate>
 

user/recommendation

Not implemented yet.

user/editable

Not implemented yet.

Comment command

Comments are applied to things (including users and lists). If you are looking for private messages between two users, you want the message command. Functions for the 'comment' command:

comment
The comment and associated information. Read-only.
replies
Returns the replies to a given comment. Read-only.
create
Creates a new comment.

comment/comment

This returns a comment, given its id. We tried to follow RSS 2.0 as much as possible. Fields:

guid
URI. A unique universal id. It's actually the web URL to the comment.
id
The comment id (unsigned integer).
thing
The thing this comment is about (unsigned integer).
parent
The parent comment id, if this is a reply; 0 otherwise.
replies
Number of replies for this comment.
author
Author username.
authorLink
Link for author's page.
authorRate
Author's rate for the thing.
pubDate
Date it was written.
title
Title or subject.
message
Message. May contain safe HTML code.
from
From which URL has this been written? May be empty.
link
Web url for this comment.
created
Date it was written. Same as pubDate.
updated
Date it was last updated.
like
How many like votes for this comment.
whatever
How many whatever votes for this comment.
hate
How many hate votes for this comment.
average
Average score for this comment.

Here's an example for the query: http://sandbox.likeorhate.com/rest/comment/comment/?id=xx:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <item count="1" xml:lang="en">
        <guid>http://sandbox.likeorhate.com/comment/10</guid>
        <id>10</id>
        <thing>9</thing>
        <parent>0</parent>
        <replies>0</replies>
        <author>likeorhate</author>
        <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
        <authorRate>like</authorRate>
        <pubDate>2010-03-01 14:04:37</pubDate>
        <title>Test message</title>
        <message>&lt;p&gt;&lt;b&gt;Best&lt;/b&gt; site ever!&lt;/p&gt;</message>
        <from />
        <link href="http://sandbox.likeorhate.com/comment/10" rel="self" />
        <created>2010-03-01 14:04:37</created>
        <updated>2010-03-01 14:04:37</updated>
        <like>0</like>
        <whatever>0</whatever>
        <hate>0</hate>
        <average>0.5</average>
    </item>
</likeorhate>
 

comment/replies

This returns all the replies for a comment, given its id.

Here's an example for the query: http://sandbox.likeorhate.com/rest/comment/replies/?id=:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <item count="1" xml:lang="en">
        <guid>http://sandbox.likeorhate.com/comment/10</guid>
        <id>10</id>
        <thing>9</thing>
        <parent>0</parent>
        <replies>0</replies>
        <author>likeorhate</author>
        <authorLink>http://sandbox.likeorhate.com/user/likeorhate</authorLink>
        <authorRate>like</authorRate>
        <pubDate>2010-03-01 14:04:37</pubDate>
        <title>Test message</title>
        <message>&lt;p&gt;&lt;b&gt;Best&lt;/b&gt; site ever!&lt;/p&gt;</message>
        <from />
        <link href="http://sandbox.likeorhate.com/comment/10" rel="self" />
        <created>2010-03-01 14:04:37</created>
        <updated>2010-03-01 14:04:37</updated>
        <like>0</like>
        <whatever>0</whatever>
        <hate>0</hate>
        <average>0.5</average>
    </item>
</likeorhate>
 

comment/create

Creates a new comment. Must be POST. Arguments:

thing
The id for the thing you're commenting.
language
The language of this comment.
subject
The subject. Cannot be null, unless it's a reply.
message
The comment body. May contain HTML, but it will be filtered to remove everything except basic tags.
parent
Optional. The id for the comment you're replying to. If not a reply, don't set this field or set it to 0.
postedFrom
Optional. URL where the comment was posted.

We return the new comment id and the id of the thing it's about.

Here's an example for the query: http://sandbox.likeorhate.com/rest/comment/create/:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <comment>
        <id>23</id>
        <thingid>1</thingid>
    </comment>
</likeorhate>
 

List command

Functions for the 'list' command:

base
The list with basic information. Read-only.
information
The list and more information. Read-only.
create
Creates a new list. Write-only

Remember that list are things, so you can use functions from the thing command as well.

list/base

This returns basic information about a list, including name, description and a list of items.

Here's an example for the query: http://sandbox.likeorhate.com/rest/list/base/?id=:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <thing>
        <id>14</id>
        <label xml:lang="en">Basic list</label>
        <link href="http://sandbox.likeorhate.com/thing/14/" rel="self" />
        <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
    </thing>
</likeorhate>
 

list/information

This returns extended information about a list, including name, description, statistics and detailed information on its things.

Here's an example for the query: http://sandbox.likeorhate.com/rest/list/information/?id=:

<likeorhate status="true" version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:media="http://search.yahoo.com/mrss" xmlns:osoc="http://web-semantics.org/ns/opensocial" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xfn="http://gmpg.org/xfn/11#">
    <thinglist>
        <items total="3">
            <item>
                <thing>
                    <id>9</id>
                    <label xml:lang="en">LikeOrHate.com</label>
                    <link href="http://sandbox.likeorhate.com/thing/9/" rel="self" />
                    <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
                </thing>
                <note />
            </item>
            <item>
                <thing>
                    <id>12</id>
                    <label xml:lang="en">Some random thing</label>
                    <link href="http://sandbox.likeorhate.com/thing/12/" rel="self" />
                    <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
                </thing>
                <note />
            </item>
            <item>
                <thing>
                    <id>13</id>
                    <label xml:lang="en">LikeOrHate Sandbox</label>
                    <link href="http://sandbox.likeorhate.com/thing/13/" rel="self" />
                    <thumb id="0" src="http://static.likeorhate.com/images/nopicture.png" />
                </thing>
                <note />
            </item>
        </items>
    </thinglist>
</likeorhate>