It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Steve Murphy Mar 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 Apr 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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

954 views 0 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you