Chi*_*ion 6 ajax rest json jira jira-rest-api
通过AJAX和REST API添加问题没有好运.我可以让它与Postmen合作,不幸的是,无法通过Ajax请求得到它.
我创建的JSON很好,也是post请求.issuetype是我自己创建的,使用Bug会产生同样的问题.查看创建的JSON对象,我的错误和我的代码:JSON对象(这是来自console.log的代码片段):

错误
0:"无法识别的标记'fils5poet5':在[来源:org.apache.catalina.connector.CoyoteInputStream@7b958ed2; line:1,column:21]中期待'null','true','false'或NaN↵"
jira = {
fields : {
project : {
key : "CIC"
},
summary : "test",
description: "test",
issuetype : {
name : "Sandbox item"
}
}
};
console.log(jira); //Also see image at top of this post.
// Submit to Jira api
$.ajax({
type : "POST",
dataType : "JSON",
url : configuration.api_url,
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic ItsAWrap!(itworks...)"),
xhr.setRequestHeader ("Content-Type", "application/json");
},
data : jira,
success : (function(response) {
//Do something
}})
Run Code Online (Sandbox Code Playgroud)
小智 3
你可以尝试这样的事情:
jira = {
"fields":
{
"project":
{
"key": "CIC"
},
"summary": data["story.name"],
"description": data["story.notes"],
"issuetype": { "name": "Sandbox item" }
}
};
//THIS BADASS FUNCTION!!!
jira = JSON.stringify(jira);
$.ajax({
type : "POST",
url : configuration.api_url,
dataType : "JSON",
async : false,
headers: {
"Authorization": "Basic YeahSomethingInAWrap",
"Content-Type": "application/json",
"Accept": "application/json",
"Cache-Control": "no-cache"
},
data : jira,
success : (function(response) {
// Hide loader
l.removeClass("show");
// Alert Success Message
alert("Melding succesvol ontvangen, bedankt!");
// Close dialog
$(".chrome-extension-dialog a.close").trigger("click");
})
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1537 次 |
| 最近记录: |