我试图在nodejs模块中实现https://developers.podio.com/doc/items/add-new-item-22362 Podio API addItem调用。下面是代码: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”属性,需要在应用程序 - 我查了一下,在波迪奥GUI。我也尝试从我发布的URL中删除尾部斜杠,然后发生类似的错误,但在错误描述中找到了URL未找到的消息。
我要设置一个代理来捕获原始请求,但也许有人只是看到代码中的错误?
任何帮助表示赞赏。