Uploaded image for project: 'Jira Cloud (including JIRA Core)'
  1. Jira Cloud (including JIRA Core)
  2. JRACLOUD-72405

The examples in the REST API v2 and v3 documentation pages can cause confusion

    XMLWordPrintable

    Details

      Description

      Summary

      Many examples on the Jira Core REST API v2 and v3 are setting the header for Bearer authentication:  "Authentication: Bearer <api_token>"

      This is confusing and often we can see in support tickets or in community threads that customers believe they have to use the API Token (that is supposed to be used for Basic Authentication only) as the <api_token>.

      It should be made clear that the header "Authentication: Bearer <api_token>" is intended to be used for Oauth only.

      Steps to Reproduce

      1. Go to https://developer.atlassian.com/cloud/jira/platform/rest/v3
      2. Search for an example related to any endpoint you may want to use, e.g. GET issue

      Expected Results

      The example should either not include authorization headers like the below one or show how to autenticate the requests in curl:

      curl --request GET \
        --url 'https://CLOUD_INSTANCE/rest/api/3/issue/{issueIdOrKey}' \
        --header 'Accept: application/json'
      

      OR:

      curl -u <EMAIL_ADDRESS>:<API_TOKEN> \
        -H 'Accept: application/json' \
        -X GET 'https://CLOUD_INSTANCE/rest/api/3/issue/{issueIdOrKey}' 
      

      Actual Results

      The example is setting the header for Bearer Authentication followed by the <access_token> that many customers are confusing with the API Token

      curl --request GET \
        --url '/rest/api/2/issue/createmeta' \
        --header 'Authorization: Bearer <access_token>' \
        --header 'Accept: application/json'
      

      Workaround

      Use the below format to authenticate REST API calls with Curl depending on the kind of authentication:

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rmassaioli Robert Massaioli (Atlassian)
              Reporter:
              dbonotto Dario B
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: