Create a Git branch
POST https://{controlplane_path}/api/1/rest/public/apim/git-branch/{path_to_apiversion_or_service}
Important: This API works for both Classic and APIM 3.0 assets.
Overview
Duplicate the Git branch associated with the Classic API version or APIM 3.0 Service and use the currently tracked commit as the head of the new branch.
Prerequisites
- Write access to the API version
- Git hosting provider requirements:
- The environment (Org) must be correctly configured to use a Git hosting provider supported by SnapLogic.
- The user must have an authenticated account with the Git hosting provider.
- The project has checked out a Git repository.
Learn more: SnapLogic - Git Integration
Limitations
- You can't use SnapLogic service accounts to call any of the SnapLogic API Management Git operation APIs.
Request
POST https://{controlplane_path}/api/1/rest/public/apim/git-branch/{path_to_apiversion_or_service}
Example
This example uses Basic authentication. For a JWT example, refer to Authentication.
curl -X 'POST' \
'https://elastic.snaplogic.com/api/1/rest/public/apim/git-branch/acme/apim/BookStore/1.0' \
-H 'Authorization: Basic {base64_encoded email:password}' \
-H 'Content-Type: application/json' \
-d '{
"branch_name": "feature-branch"
}'
Path parameters
| Key | Description |
|---|---|
controlplane_path |
Required. The SnapLogic control plane host:
elastic.snaplogic.com (US) or
emea.snaplogic.com (EU). |
path_to_apiversion |
Required.
The path to the SnapLogic API version.
Format: Important: The path comparison is case-sensitive.
|
Query parameters
None.
Request header
Use the application/json content type with basic authentication (email
and password) or a JWT. For examples, refer to Authentication.
Request body
{
"branch_name" : "..."
}
| Key | Type | Description |
|---|---|---|
branch_name |
string | The name of the Git branch to create. |
Response
{
"response_map": {
"branch_name": "...",
"ref": "refs/heads/...",
"sha": "..."
},
"http_status_code": 200
}
| Key | Type | Description |
|---|---|---|
branch_name |
string | The name of the Git branch created |
ref |
path | Points to the new branch. |
sha |
string | The unique ID of the commit. |
Error handling
{
"http_status_code": 409,
"response_map": {
"error_list": [
{
"message": "Branch API version already exists for repo"
}
]
}
}
| HTTP status codes | Status | Description | Resolution |
|---|---|---|---|
409 |
Conflict |
The API returns this response when a branch with that name already exists. | Change the name of the branch or delete the existing branch. |