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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Introducing Confluence Cloud and Jira Software Cloud Premium

Wherever you are in your team’s journey , our goal is to support your big ambitions. We’re a cloud-first company with the mission of unleashing the potential of every team, and to address the range ...

590 views 4 17
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