This page has example json, XML, and PHP responses generated from the API directly.
Scroll down to see the XML and PHP examples.
This first example is JSON pretty-printed by a Javascript that Micah found (which I uploaded to PBWiki as a file). We call the API specifying a Javascript response type, not JSON. The Javascript response type just passes the JSON to our callback, so it's the same JSON that we'd see if we specified the JSON response type.
Note that this example sends the API request to testapi.digg.internal, which is only accessible from inside the Digg LAN.
The next example uses the sourcecallback argument, which passes the response to our Javascript callback as an htmlescaped string. The response type is obeyed in generating the response, but the response is then turned into a Javascript string and passed to the Javascript callback function.
Note that this example sends the API request to nancyapi2.digg.internal, which is only accessible from inside the Digg LAN. Since the sourcecallback argument is not supported on the trunk yet, this only works because nancyapi2 is switched to the sourcecallback branch.
The next example, also from nancyapi2.digg.internal, uses the sourcecallback arg to display a PHP response. We haven't yet thought about how to pretty-print the PHP response.
Page Information
|
Wiki Information |
Recent PBwiki Blog Posts |