Commit project files
Commits the specified assets in a project to the linked Git repository.
POST https://{controlplane_path}/api/1/rest/public/project/commit/{project_path}
Overview
Commits the specified assets in a project to the linked Git repository. This API is available for all Git integrations: GitHub, GitHub Enterprise Server, GitLab, Azure, and Bitbucket.
Prerequisites
- Write access to the Project or Project Space
- 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.
Learn more: SnapLogic - Git Integration
Limitations
- You cannot use SnapLogic service accounts to call any of the SnapLogic Git operation APIs.
Path parameters
| Key | Description |
|---|---|
controlplane_path |
Required. The path to the SnapLogic control plane:
elastic.snaplogic.com
For the UAT or EMEA control plane, substitute the name for elastic. For
example:
|
project_path |
Required.
The path to the SnapLogic project.
Format:
Important: The path comparison is case-sensitive.
|
Query parameters
None.
Request header
Basic authentication
To use basic authentication, specify Basic for authorization in the request
header, add your credentials (email and password for your SnapLogic user or service account), and
specify application/json for content type. For example:
Authorization: Basic {base64_encoded <email>:<password>}
Content-Type: application/json
Example of basic authentication using Postman:
Learn more about the basic authentication header in REST API requests.
JWT authentication
When using JWT authentication, the API request includes specific headers. In the request header,
specify Bearer Token for authorization, add the token, and specify
application/json for content type. These headers are automatically added when
you configure bearer token authentication in your API client. The authorization header contains
the word Bearer followed by a space and your JWT.
Authorization: Bearer Token {token}
Content-Type: application/json
Example of JWT authentication using Postman:
Request body
{
"msg": "commit message",
"asset_path_list": [
"Org/ProjectSpace/Project/Task",
"Org/ProjectSpace/Project/Pipeline"
]
}
| Key | Type | Description |
|---|---|---|
msg |
string | The commit message added in Git. |
asset_path_list |
array | The list of asset paths to commit. |
Response
{
"response_map": {
"inserts": [
{
"path": "test_task.slt",
"name": "test_task",
"type": "Job",
"asset_path": "/snaplogic/test/test_project/test_task"
}
],
"updates": [
{
"path": "test_pipeline.slp",
"name": "test_pipeline",
"type": "Pipeline",
"asset_path": "/snaplogic/test/test_project/test_pipeline"
}
],
"deletes": [],
"renamed": [],
"branch": "heads/main",
"sha": "9f486483f25d25f41719c81a6743825b9ea8e245"
},
"http_status_code": 200
}
| Key | Type | Description |
|---|---|---|
inserts |
array | Assets that were added to the repository for the first time. |
updates |
array | Assets that were modified and committed. |
deletes |
array | Assets that were removed from the repository. |
renamed |
array | Assets that were renamed. |
branch |
string | The Git branch that the project is tracking. Format:
heads/branch_name. |
sha |
string | The SHA of the new Git commit. |
Example
This example uses Basic authentication. For a JWT example, refer to Authentication.
curl -X POST \
'https://elastic.snaplogic.com/api/1/rest/public/project/commit/acme/MySpace/MyProject' \
-H 'Authorization: Basic {base64_encoded email:password}' \
-H 'Content-Type: application/json' \
-d '{
"msg": "Add new pipeline",
"asset_path_list": [
"acme/MySpace/MyProject/my_pipeline"
]
}'