Google Apps Script to Create Confluence Page -- HTTP 500 Error

Steve Murphy March 21, 2019

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.

1 answer

0 votes
Steve Murphy April 12, 2019

I solved the problem. If anyone else is interested, please see the following:

 

https://stackoverflow.com/questions/55308969/google-apps-script-to-create-confluence-page-results-in-status-code-500

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events