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 Integrations. The behaviour of the API is same for all the Git Integrations.

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.
    • Git token to call REST API's.

    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

In the request header, specify Basic for authorization, add your credentials (Login and password of your SnapLogic user or service account), and specify application/json for content type. For more details on accounts refer to Manage accounts.


Authorization: Basic {base64_encoded <email>:<password>}
Content-Type: application/json
          

Example of Basic authenthication using Postman

JWT authentication

When using JWT authentication, the API requests 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 token.


Authorization: Bearer Token {token}
Content-Type: application/json
          

Example of JWT authenthication 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 string The asset path to commit to Git.

Response

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

Key Type Description
inserts, updates,deletes array The list of assests that were inserted, updated or deleted.
branch array The branch name to which the Git commits are done.
sha String The exact Git commit version of the API response.

Example

Request body

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

Response

[
  {
    "response_map": {
      "inserts": [
        {
          "path": "test2.slt",
          "name": "test2",
          "type": "Job",
          "asset_path": "/snaplogic/test/test_project/test2"
        },
        
      "updates": [
        {
          "path": "test4.slt",
          "name": "test4",
          "type": "Job",
          "asset_path": "/snaplogic/test/test_gitlab/test4"
        }
      ],
      "branch": "heads/test",
      "sha": "9f486483f25d25f41719c81a6743825b9ea8e245"
    },
    "http_status_code": 200
  }
 ]