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

Give Javascript API request access to more API resources

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      When trying to access the /2.0/addon/linkers resource using the request function defined by Bitbucket's Javascript API from the configuration page of an addon I get the folowing result with a 404 response code:

      {{

      Unable to find source-code formatter for language: "request_failed", message: "request failed". Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      }}
      
      Example code:
      
      {code:js}
      AP.require('request', function(request){
        request({
          url: '/2.0/addon/linkers',
          success: function(responseText){
            console.log(responseText);
          },
          error: function(responseText){
            console.log(responseText);
          }
        });
      });
      

      However, the documentation on the request function states that the XMLHttpRequest is executed "in the context of the host application", so I assume it should have access to all Bitbucket resources the addon / user has access to, and this should include the addon's own linkers.

      When doing a request to the /2.0/addon/linkers resource using a JWT token generated for the addon I do get a valid response.

      Attachments

        Activity

          People

            Unassigned Unassigned
            48f00a7333f7 Seppe Stas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: