Skip to content

Latest commit

 

History

History
331 lines (207 loc) · 3.32 KB

create-branch-a9ce22e.md

File metadata and controls

331 lines (207 loc) · 3.32 KB

Create Branch

Create a new branch.

URI: /sap/opu/odata/sap/MANAGE_GIT_REPOSITORY/Branches

Operation Type: CRUD

**HTTP Method:**POST

Request Headers


Header

Required

Values

Accept

no

application/json

application/xml

Content-Type

no

application/json

application/xml

x-csrf-token

yes

Value of x-csrf-token

Request Parameters


Parameter

Required

Data Type

Description

Parameter Type

sc_name

yes

string

name of the software component

Request body

branch_name

yes

string

name of the branch

Request body

derived_from

yes

string

name of the original branch form which the branch was derived

Request body

Request Example

Sample Code:

POST/sap/opu/odata/sap/MANAGE_GIT_REPOSITORY/Branches HTTP/1.1
Host: host.com
Authentication: basicAuthentication
X-csrf-token: xCsrfToken
Content-Type: application/json
Accept: application/json
	{
"sc_name" : "/DMO/GIT_REPOSITORY",
"derived_from" : "main",
"branch_name" : "newBranch"
	}

Response Status and Error Codes


Code

Reason

Description

201

Created

Branch was created successfully

400

Bad Request

Could not create a branch due to the values passed in the request body.

Request Payload Example

Sample Code:

{
	"d": {
		"__metadata": {
			"id": "https://host.com/sap/opu/odata/sap/MANAGE_GIT_REPOSITORY/Branches(branch_name='newBranch',sc_name='/DMO/GIT_REPOSITORY')",
			"uri": "https://host.com/sap/opu/odata/sap/MANAGE_GIT_REPOSITORY/Branches(branch_name='newBranch',sc_name='/DMO/GIT_REPOSITORY')",
			"type": "cds_sd_a4c_a2g_gha_sc_web_api.BranchesType"
		},
		"branch_name": "newBranch",
		"sc_name": "/DMO/GIT_REPOSITORY",
		"is_active": false,
		"criticality": 0,
		"derived_from": "master",
		"created_by": "CC0000000001",
		"created_on": "/Date(1584967657000+0000)/",
		"last_commit_on": "/Date(1584634658000+0000)/"
	}
}