Documentation 40

Guide · Bitbucket

How do I test a Bitbucket integration without a real workspace?

You do not need one. Point your client at a read-only Bitbucket replica that already holds the olympus-labs data set, and your code runs unchanged.

01 / The one change

Swap the base URL. Nothing else.

Your client talks to api.bitbucket.org. Point it at bb.sandboxapis.dev instead: same paths, same JSON, same headers, same status codes. No workspace to create, no seed script.

For CI, use a pinned host. This page uses bb-v2-g12.snap.sandboxapis.dev, the newest pin for Bitbucket, which answers the same bytes on every run, so an assertion written today still holds next month.

The live host, bb.sandboxapis.dev, re-rolls daily and can carry a newer generation of the data set than bb-v2-g12.snap.sandboxapis.dev; every answer on this page is for bb-v2-g12.snap.sandboxapis.dev.

02 / Run it now

One request, no account.

request.sh
curl -s "https://bb-v2-g12.snap.sandboxapis.dev/2.0/workspaces/olympus-labs"

It answers with the olympus-labs workspace, with its slug and the links to its members, its projects and its repositories, parthenon among them.

With a real client, the verified quickstart for atlassian-python-api runs against the live host on every check. It prints the repository's full name and main branch, then every open pull request on it. For CI, change its base URL to https://bb-v2-g12.snap.sandboxapis.dev.

python
# pip install atlassian-python-api==5.0.4

from atlassian.bitbucket import Cloud

bb = Cloud(
    url="https://bb.sandboxapis.dev",   # the only line that changes
    username="you@example.com",
    password="any-token",               # any app password is accepted
)

repo = bb.workspaces.get("olympus-labs").repositories.get("parthenon")
prs = [pr.title for pr in repo.pullrequests.each()]

print(repo.get_data("full_name"), "on", repo.get_data("mainbranch")["name"])
print(len(prs), "open PRs, newest:", prs[0])

What it prints always contains olympus-labs/parthenon on main and open PRs, newest:.

03 / Writes

A write gets Bitbucket's own error shape.

Every host is read-only. A write answers 403 with Bitbucket's own error body, naming what you tried, so your client's existing error handling meets a shape it knows.

403 · application/json
curl -s -X POST "https://bb-v2-g12.snap.sandboxapis.dev/2.0/repositories/olympus-labs/parthenon/pullrequests" -H 'content-type: application/json' -d '{"title":"test"}'

{"type":"error","error":{"message":"This universe is read-only. See what's covered at https://sandboxapis.dev/coverage. (You tried to POST /2.0/repositories/olympus-labs/parthenon/pullrequests.) Tell us what you needed to write: https://sandboxapis.dev/feedback"}}

04 / Where it stops

Coverage is counted, not claimed.

128 of 184 Bitbucket read surfaces are served and verified against Bitbucket's own published spec. A call to one that is not covered returns a 404 with an X-SandboxAPIs-Coverage header, never invented data. The row-by-row list is on the Bitbucket reference and the coverage page.

Next: read the Bitbucket quickstart, or run the four-hop walk to watch one incident cross four services.

What this is not

Read this before you rely on it.

SandboxAPIs is read-only: a write returns the provider's own error unless your key has opted in to scratch writes, and those never reach anybody else. Coverage is bounded, and the manifest that says exactly where it stops is public. The data is a simulated company, not yours and not a copy of anybody's. And it reproduces what each vendor documents and publishes, not the vendor's undocumented behaviour, so keep one test against the real service for that.