Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence REST API returns 403 Forbidden error

川村美穂
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2023

Hi. I have a question about Confluence's Rest API.

I've been using Google Apps Scripts to get information of confluence pages.

It worked fine until few days ago, but when I ran the script today, it started to return the error below:

Exception: Request failed for myurl returned code 403. Truncated server response: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

I haven't changed any code, and curl command works fine.

 

What are possible causes of this mysterious error?

 

My gas code to get confluence page is below:

function create_headers()

{

return {

'content-type' : 'application/json',

'Authorization': 'Bearer ' + PropertiesService.getScriptProperties().getProperty("CONFLUENCE_TOKEN"),

};

}

function getChildPages(page_id)
{
var headers = create_headers();

var options = {

'headers' : headers,

'method' : 'get',
};

var api_url = myurl + '/rest/api/content/' + page_id + '/child' + '?expand=page';
var response =
UrlFetchApp.fetch(api_url, options);
var content_json = JSON.parse(response.getContentText('UTF-8'));

return content_json["page"]["results"];

 

I appreciate your help.

1 answer

1 vote
Ken Wu _Miansheng_ June 14, 2023

I am also encountering this problem now with the same situation, I can use the Confluence REST API before but now it returns 403 error.

Ken Wu _Miansheng_ June 14, 2023

Seems something is changed to the account.

川村美穂
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 26, 2023

Hi. I finally solved this problem!

 

It was web application firewall(WAF) restrictions of Confluence Server(my company's infrastructure team solved it).

Ken Wu _Miansheng_ June 26, 2023

Such a good news!

Like 川村美穂 likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events