Sync API collections with GitLab, Bitbucket and GitHub Enterprise
Plenty of teams keep their code on GitLab or Bitbucket, or on a GitHub Enterprise server inside the company. Collection sync works the same way on all of them: a collection is linked to a folder on a branch, people pull and push from the Git sync dialog, and the files are ordinary YAML that reviewers read in merge requests.
This post covers how to connect each host. For what sync does once it's connected, start with Sync API collections with Git.
GitLab
The quickest way is Git sync ▸ Connect GitLab: approve Requestarium on gitlab.com and you're done. Access tokens last two hours and are refreshed in the background.
If you'd rather grant less, paste a token instead:
| Token | Where | Needs |
|---|---|---|
Personal access token (glpat-…) | GitLab ▸ Edit profile ▸ Access tokens | scope api and an expiry date |
| Project or group access token | Project ▸ Settings ▸ Access tokens | scope api, role Developer (Maintainer for protected branches) |
Why api and not write_repository? Requestarium commits through GitLab's Commits API, and write_repository only covers Git over HTTP. GitLab has no per-repository OAuth grant, so a project access token is the way to limit Requestarium to a single project. Either way, Requestarium only lists projects where you're at least Developer, and only ever writes inside the linked collection's folder.
Bitbucket Cloud
Git sync ▸ Connect Bitbucket asks for Account: Read and Repositories: Write. Or paste an Atlassian API token with scopes (id.atlassian.com ▸ Security ▸ API tokens) with:
read:user:bitbucketread:repository:bitbucketwrite:repository:bitbucket
and enter the email of your Atlassian account with it. Bitbucket app passwords aren't supported, because Atlassian has retired them. Repository and workspace access tokens aren't supported yet either. Bitbucket Data Center isn't supported.
Bitbucket has no revoke call, so Disconnect deletes the stored tokens and you remove the authorization under Bitbucket ▸ Personal settings ▸ App authorizations.
GitHub Enterprise Server and self-managed GitLab
Choose Connect with a token and put the server's address in the Host field: git.example.com, or example.com/gitlab when GitLab runs under a path. Leave Host empty for github.com and gitlab.com. https:// is optional, and plain http is refused.
- GitHub Enterprise Server: a fine-grained token with Contents: Read and write on the repositories to sync, or a classic token with
repo. - Self-managed GitLab: a token with the
apiscope, as above.
Requestarium cloud only connects to public addresses, so the server has to be reachable from the internet. A Git server that only exists inside the company network needs self-hosted Requestarium.
A link remembers its server. A teammate who wants to pull or push the same collection connects to the same server.
Tokens are stored encrypted, and they don't refresh
Pasted tokens are checked against the host (GET /user) and stored encrypted. They aren't refreshed, so when one expires sync answers "connect again" and you paste a new one. Pick an expiry you'll remember, or use a workspace bot so the whole team doesn't depend on one person's token.
Two people pushing at once
Requestarium always checks that the branch head is still the commit your app merged against before it writes:
- GitHub moves the branch with a non-forced update, so a commit can never land on top of someone else's.
- Bitbucket refuses the commit (409) when the branch moved.
- GitLab can't make a commit conditional on the branch head, so every changed or deleted file carries its last commit id, and GitLab refuses the commit if any of those files changed. If someone else committed other files in the same second, the app asks you to pull first. The pull merges cleanly.
Either way, nobody's changes are silently overwritten. At worst you pull once more and push again.