尝试在 Atlassian wiki 上创建 wiki 页面。我以前使用的是 python 脚本,这段代码没有问题:
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']))
现在我正在尝试使用以下 grunt 任务配置:
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”来解决此问题。但我真的不知道或理解这如何适用于此。