Response Formats

We offer three response types in our API : XML, PHP and JSON


XML (REST)

The REST response is really simple. It's just a very simple XML output. This is the default response method, so you don't need to specify the format parameter.

<rsp stat="ok" generated_in="0.07157">
        <comment>
              <id>852331</id>
              <object_id>1418360</object_id>
              <date>2009-06-08 17:22:00</date>
              <email>tvolterrani@memup.com</email>
              <name>Thomas VOLTERRANI</name>
              <message>Bravo ! C'est tout ce que je peux dire !</message>
              <url>http://www.memup.com</url>
       </comment>
</rsp>

In the event of an error, you'll get something like this :

<rsp stat="fail">
         <err code="96" msg="comment Not found"/>
</rsp>



PHP

The PHP result is a serialized version of the REST format. So the responses will be the same as above, only as PHP objects. If you're using the PHP response, we encourage you to look at the example code we provide.

stdClass Object 
(
[1] => stdClass Object
(
[id] => xxxxxx
[object_id] => xxxxx
[date] => 2009-10-06 13:56:42
[email] => xxxxxx@gmail.com
[name] => samir
[message] => Voici mon commentaire
[url] => http://blog.wmaker.net
)

[2] => stdClass Object
(
[id] => xxxxxxxx
[object_id] => xxxxxxxxxxx
[date] => 2009-10-06 12:34:00
[email] => xxxxxxxxx@gmail.com
[name] => Jerome
[message] => i'm the samurai
[url] => http://blog.wmaker.net
)
}

In the event of an error, you'll get something like this:

stdClass Object
(
[stat] => fail
[err] => stdClass Object
(
[code] => 96
[msg] => comment Not found
)

)



JSON

JSON (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing objects and other data structures and is mainly used to transmit such structured data over a network connection (in a process called serialization)

To get an API response in JSON format, send a parameter format in the request with a value of json.

{     
"0"
{

       
"id": "xxxxx",
       
"object_id": "xxxxx",
       
"date": "2009-10-06 13:56:42",
       
"email": "xxxx@gmail.com",
       
"name": "samir",
       
"message": "Voici mon commentaire",
       
"url": "http://blog.wmaker.net",
   
}
"1"
{

       
"id": "xxxxx",
       
"object_id": "xxxxx",
       
"date": "2009-10-06 13:56:42",
       
"email": "xxxx@gmail.com",
       
"name": "jerome",
       
"message": "i'm the samurai",
       
"url": "http://blog.wmaker.net",
   
}
  "generated_in": "0.0283",
   
"stat": "ok"
}
In the event of an error, you'll get something like this:

{     
   
"generated_in": "0.0283",
   
"stat": "fail",
   
"err": {
       
"code": "1",
       
"msg": "comment Not Found"
   
}
}



API Client Libraries

PHP (1)