Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

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
titleREST Client and CURL Command
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
titlePull Request
   
POST https://elastic.snaplogic.com/api/1/rest/public/project/pull/dvorg4/projects/GitHub_Integration_TEST

    

Paste code macro
titlePull Response
{
"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

KeyValue
ref

For specifying the GIT reference to checkout. 

Default: heads/master

Example: 

{"ref" : "heads/master"}

Note

The parameter's key-value pair should be passed in JSON format.


Syntax

Paste code macro
titleREST Client and CURL Command
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
titleCheckout Request
  
POST https://elastic.snaplogic.com/api/1/rest/public/project/checkout/dvorg4/projects/GitHub_Integration_TEST

BODY: {"ref":"heads/master"}

    

Paste code macro
titleCheckout Response
{
"response_map": {
"status": "updated",
"overwritten": [],
"updated": [],
"error_msgs": [],
"created": [
"README (1).md",
"mysq",
"tespipe789",
"test",
"testtask123"
],
"ignored": [],
},
"http_status_code": 200
}