GitLab
Base URL
https://desktop-api.wbench.io/v1/proxy/gitlab/
Use https://desktop-api.wbench.io/v1/proxy/gitlab/ where GitLab's documentation uses https://gitlab.com/.
It's GitLab's own API
Everything after the base URL is GitLab's REST API, exactly as GitLab documents it: the same paths, methods, query parameters and JSON bodies. Only the address and the credential change: you send your Workbench token, and Workbench adds your company's GitLab key on the server. You never see that key.
Notes
- The connection reaches the GitLab your company's Developer app uses, with its token (
PRIVATE-TOKEN). GitLab'sLinkandX-Totalheaders aren't passed back, so page withpage=andper_page=yourself. - The connection works once a company admin has added your company's GitLab key under Company keys.
Examples
Set WB_TOKEN first: export WB_TOKEN=$(wb token).
wb
wb call gitlab 'api/v4/projects?membership=true&per_page=20'
curl
curl "https://desktop-api.wbench.io/v1/proxy/gitlab/api/v4/projects?membership=true&per_page=20" \
-H "Authorization: Bearer $(wb token)"
Python
Install: pip install python-gitlab.
import os
import gitlab
gl = gitlab.Gitlab(
"https://desktop-api.wbench.io/v1/proxy/gitlab",
oauth_token=os.environ["WB_TOKEN"], # your Workbench token, sent as Authorization: Bearer
)
for project in gl.projects.list(membership=True, per_page=20, page=1):
print(project.path_with_namespace)
TypeScript
GitLab has no official TypeScript SDK, so this example uses fetch.
const r = await fetch("https://desktop-api.wbench.io/v1/proxy/gitlab/api/v4/projects?membership=true&per_page=20", {
headers: { Authorization: `Bearer ${process.env.WB_TOKEN}` },
});
if (!r.ok) throw new Error(`${r.status}: ${(await r.json()).message}`);
console.log(await r.json());
See Limits and errors for what a refusal looks like.