Commit project files to Git

Enables Git commits using asset paths

POST https://{controlplane_path}/api/1/rest/public/project/commit/{projectpath}
Enables Git commits using asset paths

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:
  • uat.elastic.snaplogic.com
  • emea.snaplogic.com
project_path
Required. The path to the SnapLogic project.

Format: /{env_org}/{project_space}/{project_name}

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 list The list of asset paths that indicates the assets committed to Git.

Response

The Response includes a list of all the modified Assets with details on the path name and the type.

Key Type Description
inserts,updates,deletes array The list of assets that were inserted, updated or deleted.
branch array The Git branch that the project is tracking and commits to.
sha String The Git commit SHA.

Example

Request body

{                 
  "msg": "Test commit",
  "asset_path_list": 
    [
      "snaplogic/test/test_project/test2",
      "snaplogic/test/test_gitlab/test4"       
    ]
 }
        

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_gitlab/test_pipeline"
        }
      "updates": [
        {
          "path": "test_account.sla",
          "name": "test_account",
          "type": "Account",
          "asset_path": "/snaplogic/test/test_gitlab/test_account"
        }
      ],
      "branch": "heads/test",
      "sha": "9f486483f25d25f41719c81a6743825b9ea8e245"
    },
    "http_status_code": 200
  }
 ]