bitbucket

Bitbucket API client for Browser and Node.js
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.2
- 1.15.1
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.2
- 0.0.1
- 2.0.0-beta.2
- 2.0.0-beta.1
- 2.0.0-beta.0
Bitbucket.js
Bitbucket API client for Browser and Node.js
Bitbucket API docs: https://api.bitbucket.org
BITBUCKET CLOUD API LATEST UPDATES: https://developer.atlassian.com/cloud/bitbucket
Installation
via npm:
$ npm install --save bitbucket
via yarn:
$ yarn add bitbucket
Usage
Browser
<script src="https://unpkg.com/bitbucket/lib/index.umd.js"></script>
<script>
const bitbucket = new Bitbucket()
</script>
Node
const { Bitbucket } = require('bitbucket')
const bitbucket = new Bitbucket()
Client Options
You can set the APIs' baseUrl
and modify some behaviors (e.g. request timeout etc.) by passing a clientOptions object to the Bitbucket
constructor.
const clientOptions = {
baseUrl: 'https://api.bitbucket.org/2.0',
request: {
timeout: 10,
},
}
const bitbucket = new Bitbucket(clientOptions)
Authentication
Using username
and password
:
const clientOptions = {
auth: {
username: 'username',
password: 'password',
},
}
const bitbucket = new Bitbucket(clientOptions)
Using token
:
const clientOptions = {
auth: {
token: 'abcdef123456',
},
}
const bitbucket = new Bitbucket(clientOptions)
API Methods
async/await
try {
const { data, headers, status, url } = await bitbucket.<namespace>.<api>({ ...params })
} catch (err) {
const { message, error, headers, request, status } = err
}
Promise
bitbucket.<namespace>
.<api>({ ...params })
.then(({ data, headers, status, url }) => {})
.catch(({ message, error, headers, request, status }) => {})
Notes:
<namespace>
is one of the Namespace Names<api>
is one of the API Names
Namespace Names
branching_model
, branchrestrictions
, commits
, commitstatuses
, deploy
, deployments
, downloads
, hook_events
, issue_tracker
, pipelines
, projects
, pullrequests
, refs
, repositories
, search
, snippet
, snippets
, source
, ssh
, teams
, user
, users
, webhooks
API Names
Check API client docs: https://bitbucketjs.netlify.com
Examples
bitbucket.repositories
.listGlobal({})
.then(({ data }) => console.log(data.values))
.catch((err) => console.error(err))
Acknowledgement
This API client is heavily inspired by the octokit/rest.js
and a lot of ideas are taken from there. So, thanks goes to the maintainer Gregor Martynus and all the awesome contributors of octokit/rest.js
.
License
Licensed under the MIT License. Check the LICENSE file for details.