How can I add an asset to the git repository using the public api?
Based on the search results, I can see that there isn't a dedicated "add asset" Public API endpoint β instead, adding an asset to a Git repository is done through the commit API, which stages and commits assets to Git. Here's a comprehensive guide: --- Adding an Asset to a Git Repository via Public API In SnapLogic, assets with a Git status of Untracked can be added to the repository by committing them using the Public API. The commit operation effectively adds and tracks the asset in Git.
β οΈ Important Notes: - You cannot use SnapLogic service accounts for Git operation APIs β use an authorized individual user account. - A maximum of 1,000 assets per project can be tracked. - The project must already be associated with a Git repository.
--- Endpoint
POST https://{controlplane_path}/api/1/rest/public/project/commit/{project_path}
| Parameter | Description | |---|---| | controlplane_path | e.g., elastic.snaplogic.com | | project_path | Format: /{env_org}/{project_space}/{project_name} (case-sensitive) | --- Request Headers Basic Authentication:
http
Authorization: Basic {base64_encoded email:password}
Content-Type: application/json
JWT Authentication:
http
Authorization: Bearer Token {token}
Content-Type: application/json
--- Request Body
json
{
"msg": "Your commit message",
"asset_path_list": [
"Org/ProjectSpace/Project/AssetName"
]
}
| Field | Type | Description | |---|---|---| | msg | string | The commit message added in Git | | asset_path_list | list | List of asset paths to add/commit to Git | --- Example Response
json
[
{
"response_map": {
"inserts": [
{
"path": "test_pipeline.slp",
"name": "test_pipeline",
"type": "Pipeline",
"asset_path": "/snaplogic/test/test_project/test_pipeline"
}
],
"updates": [],
"deletes": [],
"branch": "heads/main",
"sha": "9f486483f25d25f41719c81a6743825b9ea8e245"
},
"http_status_code": 200
}
]
- inserts β Newly added assets - updates β Modified assets - deletes β Removed assets - branch β The Git branch the project is tracking - sha β The Git commit SHA --- Supported Git Providers This API works with all supported Git integrations: - β GitHub - β GitHub Enterprise Server (GHES) - β GitLab - β Azure Repos - β Bitbucket --- Let me know if you need further help with any other Git-related API operations!
