Read All Branches
GET {{apiPath}}/version-control/branches
The GET /version-control/branches operation returns all branches associated with the Policy Editor instance.
Query parameters
| Query parameter | Description |
|---|---|
|
Specifies the page number of results to return. |
|
Specifies the number of results to return per page. |
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{apiPath}}/version-control/branches' \
--header 'x-user-id: {{userId}}'
var options = new RestClientOptions("{{apiPath}}/version-control/branches")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Get);
request.AddHeader("x-user-id", "{{userId}}");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{apiPath}}/version-control/branches"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-user-id", "{{userId}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
GET /version-control/branches HTTP/1.1
Host: {{apiPath}}
x-user-id: {{userId}}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("{{apiPath}}/version-control/branches")
.method("GET", body)
.addHeader("x-user-id", "{{userId}}")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{apiPath}}/version-control/branches",
"method": "GET",
"timeout": 0,
"headers": {
"x-user-id": "{{userId}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'GET',
'url': '{{apiPath}}/version-control/branches',
'headers': {
'x-user-id': '{{userId}}'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "{{apiPath}}/version-control/branches"
payload = {}
headers = {
'x-user-id': '{{userId}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/version-control/branches');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-user-id' => '{{userId}}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"
url = URI("{{apiPath}}/version-control/branches")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["x-user-id"] = "{{userId}}"
response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{apiPath}}/version-control/branches")!,timeoutInterval: Double.infinity)
request.addValue("{{userId}}", forHTTPHeaderField: "x-user-id")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
200 OK
{
"pagination": {
"page": 1,
"pageSize": 100,
"totalItems": 10,
"totalPages": 1
},
"data": [
{
"id": "ce97846e-b7aa-4cd6-9b91-4d850e1754a5",
"name": "Admin Point Governance",
"head": "408b72e9-4cd2-4921-8afd-4bcd114fbc28",
"tip": {
"id": "95d83543-d97d-41d9-82cc-a1201dd69376",
"parentId": "408b72e9-4cd2-4921-8afd-4bcd114fbc28",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "ce97846e-b7aa-4cd6-9b91-4d850e1754a5"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "5961c1a5-bd57-485a-89ca-6e4458d92601",
"name": "Bank-Training-JSON-Gateway-Sideband",
"head": "e6421286-3cd9-418c-8d66-be7f3fb08d10",
"tip": {
"id": "fa7cde99-c3cc-4bf5-a63d-f23785b6721b",
"parentId": "e6421286-3cd9-418c-8d66-be7f3fb08d10",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "5961c1a5-bd57-485a-89ca-6e4458d92601"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "e94d66f9-ea57-4a92-b4a1-eb0c26af26fa",
"name": "Baseline Training Demo",
"head": "8b5491c0-b49c-404c-8ca3-382744c976ad",
"tip": {
"id": "efd05486-4093-4fde-a63d-d8c610c8472c",
"parentId": "8b5491c0-b49c-404c-8ca3-382744c976ad",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "e94d66f9-ea57-4a92-b4a1-eb0c26af26fa"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "bc61eedf-a9c1-4aae-b35f-7df637c403ed",
"name": "example-branch",
"head": "5c400c4e-ac2b-4e08-8f28-d9a25c5f037e",
"tip": {
"id": "1057e1ea-7da6-419e-b676-9a9ff2f45d5c",
"parentId": "5c400c4e-ac2b-4e08-8f28-d9a25c5f037e",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "bc61eedf-a9c1-4aae-b35f-7df637c403ed"
},
"parentId": "9df2835b-cbbb-4ef9-a20e-ab63c0b6da67"
},
{
"id": "ea22cf29-f374-4c88-b06f-b6e744736e8a",
"name": "example-child-branch",
"head": "5c400c4e-ac2b-4e08-8f28-d9a25c5f037e",
"tip": {
"id": "5f76c408-032b-453e-9fea-c4008d6a0af6",
"parentId": "5c400c4e-ac2b-4e08-8f28-d9a25c5f037e",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "ea22cf29-f374-4c88-b06f-b6e744736e8a"
},
"parentId": "9df2835b-cbbb-4ef9-a20e-ab63c0b6da67"
},
{
"id": "e3c7063a-32d7-4a34-920d-037c6b7cc7b3",
"name": "JSON PDP Bank Training",
"head": "6ccbef08-51c4-492b-be1c-d726222e7f12",
"tip": {
"id": "105e6b67-f93f-48dc-8ae7-7c7aa1fb7e5a",
"parentId": "6ccbef08-51c4-492b-be1c-d726222e7f12",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "e3c7063a-32d7-4a34-920d-037c6b7cc7b3"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "6120446f-be0d-4a7a-9ee5-103975eea1cc",
"name": "permutation logging test",
"head": "86a9927c-6c56-4cf4-9cdb-f3cb2ed2fdc1",
"tip": {
"id": "b2e46155-c9d7-48bd-85eb-d88437603d12",
"parentId": "86a9927c-6c56-4cf4-9cdb-f3cb2ed2fdc1",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "6120446f-be0d-4a7a-9ee5-103975eea1cc"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "9df2835b-cbbb-4ef9-a20e-ab63c0b6da67",
"name": "renamed-branch",
"head": "3ef4b8d4-5170-4408-b6a0-2dbbc280d12f",
"tip": {
"id": "15b99f45-0e0f-4280-8fcd-aa23d8417e6c",
"parentId": "3ef4b8d4-5170-4408-b6a0-2dbbc280d12f",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "9df2835b-cbbb-4ef9-a20e-ab63c0b6da67"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "357b30de-5047-4640-a295-301702c419e7",
"name": "Sideband and JSON PDP API Bank Training",
"head": "dd837c9b-cf82-4fbb-b4e6-70df1172fcb8",
"tip": {
"id": "bd193bc1-6327-46de-89db-cd065d92ab06",
"parentId": "dd837c9b-cf82-4fbb-b4e6-70df1172fcb8",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "357b30de-5047-4640-a295-301702c419e7"
},
"parentId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
{
"id": "62c53d22-f1e1-4507-a208-a983ec5f3e12",
"name": "SYSTEM",
"head": "bb23e640-86e0-4373-ab95-64aaf86b4e9a",
"tip": {
"id": "96d1e40e-8e41-4cc1-8c5f-7a2a9323ee6e",
"parentId": "bb23e640-86e0-4373-ab95-64aaf86b4e9a",
"state": "UNCOMMITTED",
"commitDetails": {
"userId": null,
"dateTime": null,
"message": null
},
"approvals": [],
"branchId": "62c53d22-f1e1-4507-a208-a983ec5f3e12"
},
"parentId": null
}
]
}