I'm using the following code in a Google Sheet to create a Confluence page:
headers = {"Authorization" : "Basic " + Utilities.base64Encode(user + ':' + pswd), "Content-Type": "application/json"};
url = "https://confluence.atlas.asdf.com/rest/api/content/";
var params = {
"method":"POST",
"headers":headers,
"muteHttpExceptions": false,
"type":"page",
"title":newTitle,
"space":{"key":"DOC"},
"body":{"storage":{"value": "<p>This is <br/> a new page</p>" }, "representation":"storage"}
};
var createResponse = UrlFetchApp.fetch(url, params);
json_string = createResponse.toString(); // json data as a String only.
json_response = JSON.parse(json_string); // json data as an actual json object
However, my code produces this response:
Request failed for https://confluence.atlas.asdf.com/rest/api/content/ returned code 500.
Truncated server response: {"statusCode":500,"
message":"<?> No content to map to Object due to end of input","reason":"Internal Server Error"} (use muteHttpExceptions option to examine full response)
What am I doing wrong?
Thank you.
I solved the problem. If anyone else is interested, please see the following:
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.