Skip to main content

Bitbucket Cloud

"Bitbucket Cloud is a Git-based code and CI/CD tool optimized for teams using Jira."

Configuration​

Getting Bitbucket OAuth credentials​

Start by accessing or creating an Bitbucket account.

If you do not already have a Client Id and Client Secret, you will first need to create them. Start by following these steps.

Provide a the name.

Set your callback url to the following:

http://localhost

Select the "This is a private consumer" checkbox.

Select the permissions you will need.

Once you have completed the OAuth configuration steps, note your Client Id and Client Secret for the next step.

Configuring Bitbucket OAuth Credentials in crul​

Navigate to the credentials page in crul (top right corner menu -> credentials).

Click the "create" button.

Select "OAuth" from the type dropdown, then select "Bitbucket" from the provider dropdown.

Copy the Client Id into the Client Id credentials form entry. Then copy the Client Secret into the Client Secret credentials form entry.

Test the credential by running the following query. You should see a populated token.access_token column in the results.

oauth --credential "bitbucket"

Example queries​

These examples use the endpoints described in the Bitbucket API reference.

Example 1:​

Gets the first page of public repositories.

oauth --credential "bitbucket"
|| api get https://api.bitbucket.org/2.0/repositories
--token.access_token "$token.access_token$"
|| normalize values

Example 2:​

Gets the first 10 pages of public repositories.

oauth --credential "bitbucket"
|| api get https://api.bitbucket.org/2.0/repositories
--token.access_token "$token.access_token$"
--pagination.next "next"
--pagination.max 10
|| normalize values