TracNav
Return formats
Replies from the Hyves API can be returned in 4 formats. It is important to note that each format contains exactly the same information XML, XMLP, JSON, and JSONP. The ha_format parameter specifies whether the format is either XML or JSON, by assigning it either "xml", or "json" (lowercase, without quotes). If the parameter ha_callback is present, the format becomes JSONP or XMLP. Basically, these formats are the same as the non-P variants, but call a javascript function provided in callback with the javascript object (JSONP) or the XML string (XMLP) as argument. This allows you to make cross-domain AJAX calls.
Note that in this documentation (with exception of the examples below), resulting XML is shown with enters and indentation. This is for human-readability only, and the actual returned XML(P) does not contain any unnecessary whitespace.
When for some reason an error is generated, an attempt is made to return the error in the requested format. If the requested format could not be determined, the error is returned in XML format.
The ha_callback may not be longer than 20 characters, and may only contain [A-Za-z0-9_\[\]"'.] .
Note that the rules described here do not apply if the strict_oauth_spec_response parameter is present and true. See the oAuth description for more information.
Examples
- ha_format=xml
- ha_callback not present
- XML
- Content-type: text/xml
<?xml version="1.0" encoding="UTF-8"?><users_get_result><user><userid>133_OIUG</userid><nickname>Claude</nickname><firstname/><lastname/><gender/><onmymind/><birthday/><friendscount/><url>http://claude.hyves.nl/</url><mediaid>2_Wc1K</mediaid><coutryid/><cityid/></user></users_get_result>
- ha_format=json
- ha_callback not present
- JSON
- Content-type: text/x-json
{"method":"users.get","user":[{"userid":"133_OIUG","nickname":"Claude","firstname":null,"lastname":null,"gender":null,"onmymind":null,"birthday":null,"friendscount":null,"url":"http:\/\/claude.hyves.nl\/","mediaid":"2_Wc1K","coutryid":null,"cityid":null}]}
- ha_format=xml
- ha_callback=myCallback
- XMLP
- Content-type: text/javascript
myCallback('<users_get_result><user><userid>133_OIUG<\/userid><nickname>Claude<\/nickname><firstname/><lastname/><gender/><onmymind/><birthday/><friendscount/><url>http://claude.hyves.nl/<\/url><mediaid>2_Wc1K<\/mediaid><coutryid/><cityid/><\/user><\/users_get_result>');
- ha_format=json
- ha_callback=myCallback
- JSONP
- Content-type: text/javascript
myCallback({"method":"users.get","user":[{"userid":"133_OIUG","nickname":"Claude","firstname":null,"lastname":null,"gender":null,"onmymind":null,"birthday":null,"friendscount":null,"url":"http:\/\/claude.hyves.nl\/","mediaid":"2_Wc1K","coutryid":null,"cityid":null}]});
- ha_format=json
- ha_callback=myCallback+illegal
- JSON
- Content-type: text/x-json
{"method":"error","error_code":26,"error_message":"The ha_callback variable has an illegal format.","request_parameters":{"parameter":[{"key":"ha_callback","value":"myCallback+illegal"},{"key":"ha_fancylayout","value":"false"},{"key":"ha_format","value":"json"},{"key":"ha_method","value":"users.get"},{"key":"ha_version","value":"0.9"},{"key":"oauth_consumer_key","value":"MV-oO39sc35hWWpaCFSLPSTJ"},{"key":"oauth_nonce","value":""},{"key":"oauth_signature_method","value":"HMAC-SHA1"},{"key":"oauth_timestamp","value":"1198762750"},{"key":"oauth_version","value":"1.0"},{"key":"username","value":"claude"},{"key":"oauth_signature","value":"YwRjAh7n+ZPR8Fatm8Tdvd3Xhd0="}]}}
