On this page
Table of Contents | ||||
---|---|---|---|---|
|
Overview
Projects that have been synchronized with GitHub repositories can be updated using the APIs described on this page. These APIs can be used with Continuous-Integration/Continuous-Deployment workflows to pull changes from one development stage to another and checkout GitHub repositories. There is currently no support for committing changes in a project through APIs, you will still need to do that through the Manager interface. The Authorization type supported by the APIs is Basic Auth.
Pull Request
Pull changes from a branch into the specified project. You must have already created the project and done a checkout of the branch in the Manager UI prior to calling this endpoint. This endpoint can be useful to update a project with the latest changes on a branch for testing.
Syntax
Paste code macro | ||
---|---|---|
| ||
REST Client: POST https://<POD_URL>/api/1/rest/public/project/pull/<PROJECT_PATH> CURL Command: curl -X POST \ https://<POD_URL>/api/1/rest/public/project/pull/<PROJECT_PATH> \ -H 'authorization: Basic <bearer_token>==' \ Syntax for PROJECT_PATH: ORG_NAME/PROJECT_SPACE_NAME/PROJECT_NAME |
Example
Paste code macro |
---|
REST Client: POST https://elastic.snaplogic.com/api/1/rest/public/project/pull/dvorg4/projects/GitHub_Integration_TEST CURL Command: curl -X POST \ https://elastic.snaplogic.com/api/1/rest/public/project/pull/dvorg4/projects/GitHub%20Integration%20TEST \ -H 'authorization: Basic YmFsibWlxqdrb2dpYy5jacBsb20RACQD6SIQDcyNgZmFsibWlxqdrb2dpYy9jacBsb20RACQD6SIQDcyNg==' \ |
Sample Request and Response
Paste code macro | ||
---|---|---|
| ||
POST https://elastic.snaplogic.com/api/1/rest/public/project/pull/dvorg4/projects/GitHub_Integration_TEST |
Paste code macro | ||
---|---|---|
| ||
{ "response_map": { "status": "updated", "overwritten": [], "updated": [ "test" ], "error_msgs": [], "created": [ "testpull" ], "ignored": [], }, "http_status_code": 200 } |
Checkout Repository
Does a checkout of the repository at the given reference into the project at the specified path. You must have already created the project and done a checkout in the Manager UI prior to calling this endpoint. This endpoint can be useful to update a project to a newly tagged version or revert to a previously stable tag. You will need to provide the repository's path in the body of the call.
Parameter
Key | Value | ||
---|---|---|---|
ref | For specifying the GIT reference to checkout. Default: heads/master Example: {"ref" : "heads/master"}
|
Syntax
Paste code macro | ||
---|---|---|
| ||
REST Client: POST https://<POD_URL>/api/1/rest/public/project/checkout/<PROJECT_PATH> Body: {"ref" : "heads/master"} CURL Command: curl -X POST \ https://<POD_URL>/api/1/rest/public/project/pull/<PROJECT_PATH> \ -H 'authorization: Basic <bearer_token>==' \ -F '{"ref"="heads/master"}' Syntax for PROJECT_PATH: ORG_NAME/PROJECT_SPACE_NAME/PROJECT_NAME |
Example
Paste code macro |
---|
REST Client: POST https://elastic.snaplogic.com/api/1/rest/public/project/checkout/dvorg4/projects/GitHub%20Integration%20TEST \ Body: {"ref" : "heads/master"} CURL Command: curl -X POST \ https://uat.elastic.snaplogic.com/api/1/rest/public/project/checkout/dvorg4/projects/GitHub%20Integration%20TEST \ -H 'authorization: Basic <bearer_token>==' \ -F '{"ref"="heads/master"}' |
Sample Request and Response
Paste code macro | ||
---|---|---|
| ||
POST https://elastic.snaplogic.com/api/1/rest/public/project/checkout/dvorg4/projects/GitHub_Integration_TEST BODY: {"ref":"heads/master"} |
Paste code macro | ||
---|---|---|
| ||
{ "response_map": { "status": "updated", "overwritten": [], "updated": [], "error_msgs": [], "created": [ "README (1).md", "mysq", "tespipe789", "test", "testtask123" ], "ignored": [], }, "http_status_code": 200 } |