2013-03-24 78 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

回答