如何从 Zend_Rest_Client 调用 Lithium Forum API
我正在尝试使用 Zend_Rest_Client 访问 Lithium Forum Rest API。 API 的描述如下:
http://cl.ly/3N0M2D0k0H3L0Y103Q3R
API 文档给出了示例调用,例如 / boards/id/experimentations/messages/id/938
如何使用 Zend Rest Client 复制此调用并指定每个单独的方法/参数?
我可以通过将整个 URL 放入新的 Zend_rest_Client($url) 调用中来获得响应,但我想要的不仅仅是控制权,以便我可以传递动态板和类别 id。
我尝试过类似的方法
$result = $client->arg('categories')->arg2('id')->arg3($cat->string_id)->arg4('boards')->arg5('nested')->get();
,
$result = $client->categories($cat->string_id)...
但参数被忽略。任何人都可以阐明这一点吗?
如果有人想尝试一下,这里有一个实时 API:
http://lithosphere .lithium.com/lithium/restapi/vc/boards/nested
I'm trying to access a Lithium Forum Rest API using Zend_Rest_Client. The API is described here:
http://cl.ly/3N0M2D0k0H3L0Y103Q3R
The API docs give example calls such as e.g. /boards/id/experimentations/messages/id/938
How can I replicate this call Using Zend Rest Client and specifying each individual method / parameter?
I can get a response by putting the entire URL in my new Zend_rest_Client($url) call but I want to have more than control so that I can pass dynamic board and category ids.
I have tried something like
$result = $client->arg('categories')->arg2('id')->arg3($cat->string_id)->arg4('boards')->arg5('nested')->get();
and also
$result = $client->categories($cat->string_id)...
But the parameters are ignored. Can anyone shed any light on this?
If anyone wanted to try it, there is a live API here:
http://lithosphere.lithium.com/lithium/restapi/vc/boards/nested
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这个特定的 API 与 Zend_Rest_Client 不兼容,因为它似乎不支持客户端期望的 URI 中的方法和参数。解决方案是构建动态 URL,通过 GET 调用或使用 POST 参数
looks like this particular API is not compatible with Zend_Rest_Client as it doesn't seem to support methods and parameters in the URI as the client expects. The solution is to build dynamic URLS to call via GET or use POST parameters