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

403 Forbidden error when calling Diff and DiffStat APIs from C# client. Works in POSTMAN and Node.js

    XMLWordPrintable

Details

    Description

      I am getting a 403 Forbidden error when calling Diff and DiffStat APIs from C# client. I am able to do the following calls successfully in C#.
      POST: GET TOKEN: https://bitbucket.org/site/oauth2/access_token
      GET: GET BRANCHES: [https://api.bitbucket.org/2.0/repositories/

      {accountId}/{repository}/refs/branches?page=1&pagelen=100|https://api.bitbucket.org/2.0/repositories/%257B%257BaccountId%257D%257D/%257Brepository%257D/refs/branches%3Fpage%3D1%26pagelen%3D100]

      POST: CREATE PULL REQUEST: [https://api.bitbucket.org/2.0/repositories/{accountId}

      /

      {repository}/pullrequests|https://api.bitbucket.org/2.0/repositories/%257B%257BaccountId%257D%257D/%257Brepository%257D/pullrequests]

      The following requests are failing from C# although they succeed from POSTMAN and Node.JS:

      GET: GET PULL REQUEST DIFF: [https://api.bitbucket.org/2.0/repositories/{accountId}/{repository}

      /pullrequests/

      {pullRequestId}/diff/|https://api.bitbucket.org/2.0/repositories/%257B%257BaccountId%257D%257D/%257Brepository%257D/pullrequests/%257BpullRequestId%257D/diff/]

      GET: GET PULL REQUEST DIFFSTAT: [https://api.bitbucket.org/2.0/repositories/{accountId}/{repository}/pullrequests/{pullRequestId}

      /diffstat|https://api.bitbucket.org/2.0/repositories/%257B%257BaccountId%257D%257D/%257Brepository%257D/pullrequests/%257BpullRequestId%257D/diffstat]

      I am using the following as the Authorization Header:

      Unable to find source-code formatter for language: csharp. 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
                  httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            b3175353ce21 Johnson Michael
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: