0
嘗試在Atlassian wiki上創建維基頁面。我以前使用Python腳本,該代碼工作沒有問題:發佈到Atlassian Confluence api時意外的grunt-http錯誤
data = json.dumps({"type":"page", "data":"testData", "title":postTitle,"space":{"key":"EB"}, "body":{"storage":{"value": content,"representation":"storage"}}})
r = requests.post("https://estech.atlassian.net/wiki/rest/api/content/", data=data, headers=headers, auth=(confluenceLogin['username'], confluenceLogin['password']))
現在,我嘗試使用下面的咕嚕任務配置:
http: {
atlassianwiki: {
options: {
uri: atlassianURL + "/wiki/rest/api/content/",
headers: {"Content-Type": "application/json"},
auth: {
"user": confluencelogin,
"pass": confluencepass
},
method:"POST",
body: JSON.stringify(wikijson)
}
}
}
與wikijson看起來像:
wikijson = {
"type": "page",
"data": "testData",
"title": "testtitle",
"space": {key:"EB"},
"body": {
"storage": {
"value": "<p>testing posting</p>",
"representation": "storage"
}
}
}
我在執行此任務時遇到以下錯誤:
Fatal error: 500 {"statusCode":500, "message":"java.io.EOFException: No content to map to Object due to end of input"}
經過一番Google-fu,我發現有些人聲稱他們通過在curl命令行中添加「--post302」來解決這個問題。但我並不真正瞭解或理解這裏如何應用。
謝謝,我希望這是有道理的。