我正在尝试在 nodejs 模块中实现https://developers.podio.com/doc/items/add-new-item-22362 Podio API addItem 调用。这是代码:
var _makeRequest = function(type, url, params, cb) {
var headers = {};
if(_isAuthenticated) {
headers.Authorization = 'OAuth2 ' + _access_token ;
}
console.log(url,params);
_request({method: type, url: url, json: true, form: params, headers: headers},function (error, response, body) {
if(!error && response.statusCode == 200) {
cb.call(this,body);
} else {
console.log('Error occured while launching a request to Podio: ' + error + '; body: ' + JSON.stringify (body));
}
});
}
exports.addItem = function(app_id, field_values, cb) {
_makeRequest('POST', _baseUrl + "/item/app/" + app_id + '/',{fields: {'title': 'fgdsfgdsf'}},function(response) {
cb.call(this,response);
});
它返回以下错误:
{"error_propagate":false,"error_parameters":{},"error_detail":null,"error_description":"No matching operation could be found. No body was given.","error":"not_found"}
应用程序中只需要“title”属性 - 我在 Podio GUI 中检查过。我还尝试从我发布到的 url 中删除尾部斜杠,然后发生类似的错误,但在错误描述中找不到 URL 消息。
我将设置一个代理来捕获原始请求,但也许有人只是看到代码中的错误?
任何帮助表示赞赏。