Forums

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

403 exception happened when using Rest API

Ken Wu _Miansheng_ June 14, 2023

Hello experts,

 

I have received following error message when I am trying to use Rest API by powershell to create a new confluence page.

{"message":"Current user not permitted to use Confluence","statusCode":403}

 

But I can do it successfully before with the same codes, the last successful page created was on 02/18/2023. Following is the code:

#################################

$pair = "miansheng.wu@commscope.com:generatedToken"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$auth = "Basic " + $encodedCreds;

$Headers = @{
    Authorization = $auth; 'Content-Type' = 'application/json'
}


Invoke-WebRequest -Headers $Headers -Uri $uri -Method Post -Body '{"type":"page","title":"Test page","ancestors":[{"id":3734306868}], "space":{"key":"TEAM"},"body":{"storage":{"value":"Test body","representation":"storage"}}}'
#################################
Could you please help me? This issue blocks me a lot now.
Thanks,
Ken

2 answers

0 votes
Ken Wu _Miansheng_ June 15, 2023

Could someone help me please?

0 votes
Fabio Racobaldo _Herzum_
Community Champion
June 15, 2023

Hi @Ken Wu _Miansheng_ ,

please check that user has grant to access Confluence first and token is still valid. 

Fabio

Ken Wu _Miansheng_ June 15, 2023

Hi, @Fabio Racobaldo _Herzum_ ,

Thank you for your reply.

I can login Confluence and create page by manual.

The token is valid, I created a new token but the result is the same.

 

Thanks,

Ken

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events