Request and Response Headers Override using Restler -
i new restler , trying following things, can't seem hold of it
i have class , method exposed via restler
class account { protected $api_version = array('version' => "1.0.2.1234", 'href' => "/"); // returns version of service // content-type: application/vnd.cust.version+json function version() { return json_encode($this->version); } // accepts content type: application/vnd.cust.account+json function postcreate() { } }
1) want return own content-type client in 'version' method instead of default application/json. in case 'application/vnd.cust.version+json'
2) method postcreate should accept request if contet-type set 'application/vnd.cust.account+json'. how check if header set in request.
3) in restler api explorer, methond name, how can show method name instead of 'version.json'. want show 'version' method name
thank help. narsi
1) maybe write own format? take @ http://restler3.luracast.com/examples/_003_multiformat/readme.html
2) check headers , throw exception on wrong one. take @ link http://stackoverflow.com/questions/541430/how-do-i-read-any-request-header-in-php
3) have tried , following line index.php?
resources::$useformatasextension = false
hope takes further on :)
cu inge
Comments
Post a Comment