2013-03-24 45 views
0

我是新來restler和嘗試做以下的事情響應頭覆蓋,似乎無法弄個請求和使用Restler

我有這樣的類和方法,通過Restler

class Account { 
    protected $Api_Version = array('version' => "1.0.2.1234", 'href' => "/"); 
// Returns the version of the service 
// Content-Type: application/vnd.cust.version+json 
function version() { 
return json_encode($this->version); 
} 

// Accepts only Content Type: application/vnd.cust.account+json 
function postCreate() { 

} 
} 
曝光

1)我想返回我自己的內容類型到像'版本'方法,而不是默認應用程序/ JSON的客戶端。在我的情況下,它的'application/vnd.cust.version + json'

2)如果Contet-Type設置爲'application/vnd.cust.account + json',postCreate方法應該只接受請求。如何檢查請求中是否設置了該標題。

3)另外在restler API Explorer中,對於方位名稱,我如何只顯示方法名稱而不是'version.json'。我想只顯示方法名稱「版本」

感謝您的幫助。 Narsi

回答