Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p>If you use a controller named ApisController, you have to fill mapresource with api. Example: <code>Router::mapResources('api');</code></p></li> <li><p>These are the default routes created:</p> <ul> <li>GET /apis.format RecipesController::index()</li> <li>GET /apis/123.format RecipesController::view(123)</li> <li>POST /apis.format RecipesController::add()</li> <li>PUT /apis/123.format RecipesController::edit(123)</li> <li>DELETE/apis/123.format RecipesController::delete(123)</li> <li>POST /apis/123.format RecipesController::edit(123) </li> </ul></li> </ol> <p>So if your homepage is at: <code>http://localhost/FC/</code>, you can access the resources at <code>http://localhost/FC/apis.format</code> .</p> <p>You have to substitute format with json or xml. If you want to use XML or JSON you have to declare it in <code>routes.php</code> adding <code>Router::parseExtensions();</code></p> <ol> <li><p>You have to rename your controller in ApisController and change every occurence of $this->Recipe in $this->Api, also you have to create a Model for Api and a table on the db. For xml and json you have to create views in <code>/app/Views/Apis/xml/index.ctp</code> and so on.</p> <p>// app/View/Apis/xml/index.ctp // Do some formatting and manipulation on // the $recipes array. $xml = Xml::fromArray(array('response' => $apis)); echo $xml->asXML();</p></li> </ol> <p>Last answer, your server normally answer with a 200 when there are no errors.</p> <p>I suggest you to begin with something easier and to look to Cakephp conventions. <a href="http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html" rel="nofollow">http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html</a></p> <p>Good work!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload