【发布时间】:2015-08-21 23:08:34
【问题描述】:
我正在尝试将一些数据发布到这个 API 端点,对应的 curl 调用是这样的:
curl -X POST \
-d "apiKey=YOU_API_KEY" \
-d "extractors=entities,entailments" \
-d "text=Spain's stricken Bankia expects to sell off its vast portfolio of industrial holdings that includes a stake in the parent company of British Airways and Iberia." \
https://api.textrazor.com/
如果我直接尝试将它与指定 API KEY 的针一起使用,它会成功连接到 API,但由于它缺少 text 参数,它会给我一个错误。那么如何指定多个POST 参数。
我的代码:
needle.post(TEXTRAZOR_URL,TEXTRAZOR_API_KEY,function(err, razorResponse){
console.log(err || razorResponse.body);
});
这里TEXTRAZOR_URL 是:https://api.textrazor.com/
而TEXTRAZOR_API_KEY 是:apiKey=123123123
我知道我需要更改 needle.post 中的第二个参数。我该怎么做。
【问题讨论】:
标签: javascript node.js curl express needle.js