404 NOT_FOUND when using Confluence REST API

XMLWordPrintable

    • 6
    • Severity 3 - Minor

      Issue Summary

      When passing the header 'Authorization: <api-token>' to the following endpoint:

       /wiki/api/v2/pages

      We encounter the error:

      {"errors":[{"status":404,"code":"NOT_FOUND","title":"Not Found","detail":null}]}
      

      We should only get a 404 if the user is actually authenticated, but doesn't have access. In this situation, authentication has failed.

      Steps to Reproduce

      1. Run the following cURL command:
        • curl --request POST \
            --url 'https://<instance>.atlassian.net/wiki/api/v2/pages' \
            --header 'Authorization: <api-token>' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data '{
            "spaceId": "XXXXX",
            "status": "current",
            "title": "This is a test",
            "parentId": "XXXXXX",
            "body": {
              "representation": "storage",
              "value": "<p>test</p>"
            }
          }'
          
      2. You will receive the error
        • {"errors":[{"status":404,"code":"NOT_FOUND","title":"Not Found","detail":null}]}
          
      3. Modify the Headers with Authorization Basic "<EMAIL>:<API_TOKEN>" encoded to base64.
        • --header 'Authorization: Basic <base64 encoded credentials>'
          
      4. The call will be completed successfully

      Expected Results

      The response should return a 401 unauthorized since the authorization header only contains the token and not the base64 encoded credentials.

      Actual Results

      The response returned is a 404 NOT_FOUND.

      Workaround

      Ensure you are passing 'Authorization: Basic <base64 encoded credentials>'.

            Assignee:
            Vinodh Nagarajan (Inactive)
            Reporter:
            Tina Bolton
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: