Authentication and Permissions I use two types of authentication, Basic HTTP Authentication and Digest Authentication. Digest is the preferred method and if you are using a script as a webservice client (opposed to straight command line curl) I suggest you use the Digest parameters of curl. Basic HTTP Authentication is used if called from a command line (curl -u user:pass). The credentials and permissions used are the same as your regular website login account therefore you can only view and edit topics that you would normally have access too. Most of the API's can be accessed anonymously and do NOT require user authentication. To gain public access to an API you can either omit the user/pass or set the user/pass to anonymous.
Syntax In the API documentation below, v stands for the API version number (versions are in the form of v1 v2 v3...), tid is a variable describing the topic ID, format is a variable describing the output format (options are xml or json). The output format can either be specified through the URL (rest/v/topic/255.json) or through the html Accept Header (curl -H "Accept: application/json"). The URL method is preferred and takes precedence over the Accept header and json is always the default output format if none is specified.
Live Sample: http://mreschke.com/rest/v1/topic/255.xml Live Sample: http://mreschke.com/rest/v1/topic/255.json Live Sample: http://mreschke.com/rest/v1/topic/255?plaintext=1
Current Version is v1
Live Sample: http://mreschke.com/rest/v1/search/.xml Live Sample: http://mreschke.com/rest/v1/search/.json Live Sample: http://mreschke.com/rest/v1/search/.xml?plaintext=1 Live Sample: http://mreschke.com/rest/v1/search/*/LINUX.xml
This API uses the same URL scheme that my sites main /search page uses, so /search/*/LINUX for all LINUX badged articles, or /search/query+here to search for your query... So using POST really isn't that beneficial since the only thing to POST is the optional parameters.
Use URL encoding for spaces, example, /search/my+query+with+spaces xxx means the standard URL based search parameters used by this websites search engine
Easily create a PHP client like this
$jsonurl = 'http://mreschke.com/rest/v1/topic/255.json'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $jsonurl); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 10); $json = curl_exec($ch); curl_close($ch); echo $json;