Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

401 Unauthorized when special characters are used in rest template request

Andreas Purde
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 15, 2017

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
Atlassian Team members are employees working across the company in a wide variety of roles.
February 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
AUG Leaders

Atlassian Community Events