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

401 Unauthorized when special characters are used in rest template request

Dear Community,

I'm again facing issues when special characters are used in rest template requests towards Confluence: Confluence returns 401.

Getting a page with title "Test 1" works. Getting a page with title "Test ä" or "Test &" however don't work.

A working example:

https://edrup-dev4.atlassian.net/wiki/rest/api/content?spaceKey=CT&title=Cite%20source%201&expand=body.storage%2Cversion

Not working:

https://edrup-dev4.atlassian.net/wiki/rest/api/content?spaceKey=CT&title=Cite%20source%C3%A4%C3%BC%C3%9F%201&expand=body.storage%2Cversion

Remark: when I HTML-escape the Umlauts in the sample before JWT signing works but Confluence is then not able to find the content.

Any ideas?

Thank you

Andreas

1 answer

0 votes
Dario B Atlassian Team Feb 12, 2020

Hello @Andreas Purde ,

I am unable to reproduce the reported issues: neither the 401 nor the empty content.

I have tried in the browser as well as using Postman and Curl. The only difference is that in Curl you can only pass the title url-encoded (in the browser and in postman it gets url-encoded automatically):

curl -u <EMAIL-ADDRESS>:<API-TOKEN> "https://SITE-NAME.atlassian.net/wiki/rest/api/content?spaceKey=QWER&title=Test+%C3%A4&expand=body.storage,version" | json_pp 

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5926    0  5926    0     0  11574      0 --:--:-- --:--:-- --:--:-- 11551

 

{
   "start" : 0,
   "limit" : 25,
   "_links" : {
      "base" : "https://SITE-NAME.atlassian.net/wiki",
      "self" : "https://SITE-NAME.atlassian.net/wiki/rest/api/content?spaceKey=QWER&expand=body.storage,version&title=Test+%C3%A4",

      "context" : "/wiki"
   },
   "results" : [
      {
         "macroRenderedOutput" : {},
         "type" : "page",....
....

 

Can you kindly repeat the same test on your side and let me know if you get the same results?

 

Also, in case you still face the issue, as possible workaround you can either:

  1. Use the page-id instead of the page title
  2. Send a POST request (instead of GET) and send the space name and page title in the request body

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,340 views 6 6
Join discussion

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