Versions Compared

Key

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

In this Article

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

Overview

You can update Projects that are synchronized with GitHub repositories by using the APIs described in this article. Use these APIs with Continuous-Integration/Continuous-Deployment workflows to pull changes from one development stage to another and checkout GitHub repositories. You still need commit changes 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 ZmFsibWlxqdrb2dpYy9jacBsb20RACQD6SIQDcyNg==' \

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

Do a checkout of the repository at the given reference into the project at the specified path. You must create the project first and do a checkout in the Manager UI before 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 need to provide the repository 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
}