API 使用 Postman 进行网络服务测试

API webservice testing with Postman

我在 Chrome 中安装了 Postman 来测试 Kairos API 网络服务。我设置了以下字段:

我收到错误消息,但关于 API 文档,它应该以这种格式工作。

Authentication parameters missing

Kairos 的网站上写着:

Requests must be authenticated with your API key. This must be sent as an HTTP header.

所以点击 "Previously Used" 下的 "Add token to the header" 单选按钮而不是 "Add token to the url" 按钮,它应该可以工作!

API 提示您输入开发者 APP ID 和 APP KEY。您的请求中缺少这些 headers。

这是一个通过 Curl 的例子:

curl -s -X POST http://api.kairos.com/detect \
-H "content-type: application/json" \
-H "app_id: xxxxxx" \
-H "app_key: xxxxxx"  \
-d '{ "image": "http://media.kairos.com/test1.jpg" }'

确保将 xxxxxx 字符串替换为您的开发人员 APP_ID 和 APP_KEY。

你可以register for a free developer account and you can browse the API documentation here.