Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-23839

Code Search API does not return results with token based auth

XMLWordPrintable

      Issue Summary

      • When performing an API call to the *workspaces/ {workspace}

        /search/code* endpoint using any token-based authentication, the results return empty

      Steps to Reproduce

      1. Create a workspace access token (just as an example)
      2. Run the API call using the token for authentication:
        $ Curl -X GET -H "Authorization: Bearer <WAT>" "https://api.bitbucket.org/2.0/workspaces/<workspace>/search/code?search_query=<query>"
        

      Expected Results

      • Code Search results should be returned

      Actual Results

      • The results array returns empty, even though there are results that match the query:
        {
          "size": 0,
          "page": 1,
          "pagelen": 10,
          "query_substituted": false,
          "values": []
        }
        

      Workaround

      • Run the API using an app password for authentication:
        $ Curl -X GET -u <username>:<apppassword> "https://api.bitbucket.org/2.0/workspaces/<workspace>/search/code?search_query=<query>"
        

              Unassigned Unassigned
              0298b2749e0b Mateus T
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: