我正在围绕 Bitbucket REST API 构建 nodejs 包装器,这里是用于创建问题的 REST API 的文档https://confluence.atlassian.com/display/BITBUCKET/issues+Resource#issuesResource-POSTanewissue
每次我尝试创建问题时,服务都会返回 400 错误,表示缺少一些必填字段,下面是我的代码
this.createIssue = function(accountName, repoName, title,callback) {
var options = {
rejectUnauthorized: this.strictSSL,
uri: this.makeUri('/repositories/'+accountName+'/'+repoName+'/issues'),
method: "POST",
followAllRedirects: true,
json: true,
body:{
title:title,
}
};
console.log(options.body)
this.doRequest(options, function(error, response, body) {
if (error) {
callback(error, null);
return;
}
if (response.statusCode === 404) {
callback('Version does not exist or the currently authenticated user does not have permission to view it');
return;
}
if (response.statusCode === 403) {
callback('The currently authenticated user does not have permission to edit the version');
return;
}
if (response.statusCode !== 200) {
callback(response.statusCode + ': Unable to connect to JIRA during createVersion.');
return;
}
callback(null,body)
});
};
我不确定我做错了什么,或者我错过了什么?