You can import workspaces from a GitHub or GitLab repository (public or private).
API Endpoint: POST /admin/api/workspace/import
Note: If you're importing from a private GitHub or GitLab repository, you must provide the Auth
token.
Note: This API endpoint accepts and responds only in JSON.
Name | Description |
---|---|
source (string, required) |
Specifies that the repository type is GitHub. Enter "GitHub" as the value of the string to indicate that the repository is GitHub. |
input_url (string, required) |
The GitHub URL. The URL must end with archive/[branch].zip. |
auth_token (string, optional) |
The Auth token (only required for private GitHub repositories). |
overwrite (boolean, optional) Default value: false |
Overwrites content of existing workspace. |
Name | Description |
---|---|
source (string, required) |
Specifies that the repository type is GitLab. Enter "GitLab" as the value of the string to indicate that the repository is GitLab. |
gitlab_domain (string, required) |
The GitLab domain name. The domain name must begin with https://. |
gitlab_number (integer, required) |
The GitLab ID number. |
gitlab_branch (string, required) |
The GitLab branch. |
auth_token (string, optional) |
The Auth token (only required for private GitLab repositories). |
overwrite (boolean, optional) Default value: false |
Overwrites content of existing workspace. |
Example Request for GitHub
Import
curl -X POST \ http://[GATEWAY URL]/admin/api/workspace/import \ -H 'Authorization: BAMAuthToken: [BAM Auth token]' \ -H 'Content-Type: application/json' \ -d '{ "source": "GitHub", "input_url": "http://github.com/example/gateway-workflows/archive/master.zip", "auth_token": "84a9bfe3e1594452b754db94ebcc9af8b9ed54dc", "overwrite": false }
Example Request for GitLab
Import
curl -X POST \ http://[GATEWAY URL]/admin/api/workspace/import \ -H 'Authorization: BAMAuthToken: [BAM Auth token]' \ -H 'Content-Type: application/json' \ -d '{ "source": "GitLab", "gitlab_domain": "https://gitlab.example.net", "gitlab_number": 2378, "gitlab_branch": "master", "auth_token": "06780dd508ee4673a978efe0ec85ed79b5e59b51", "overwrite": true }