Application Programming Interface Guide > REST API > TDV Server REST APIs > Version Control System
 
Version Control System
The VCS operations that can be performed on the TDV resources are:
GET /branches
GET /branches/{name}
POST /checkin/{name}
GET /connection
GET /connection/{name}
GET /content/{name}
POST /discard/{name}
GET /enable
POST /fetch/{name}
GET /history/{name}
GET /latestcontent/{name}
GET /localcontent/{name}
GET /root
GET /root/{name}
POST /root/{name}
DELETE /root/{name}
POST /setCredential/{name}
GET /status/{name}
GET /vcsAdapter/{adapter_name}
GET /vcsAdapters
POST /vcsInstance
GET /vcsInstance/{name}
PUT /vcsInstance/{name}
DELETE /vcsInstance/{name}
GET /vcsInstances
GET /branches
This API is used to get branches by VCS adapter name and remote VCS url. it is only for GIT
Parameters:
Name
Description
Parameter Type
Data Type
adapterName
The name of the adapter
query
string
url
 
header
string
user
 
header
string
password
 
header
string
base64Cer
It is an optional parameter used on git https with ssl certificate support.
for other usage, this can be Null.
query
string
Example to get branches by VCS adapter name and remote VCS url.
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/branches?adaptername={adapterName}&base64Cer={pem format certificate}" -H "Content-Type: application/json" -H "user: {user}" -H "password: {password}" -H "url: {url}"
GET /branches/{name}
This API is used to get branches by VCS instance name. it is only for GIT.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to get branches by VCS instance name
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/branches/{vcsInstanceName}" -H "Content-Type: application/json"
POST /checkin/{name}
This API is used to checkin the resource into vcs.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
body
 
body
Model schema
Request Body
Example Value - Schema
{
“createdResources”:[
{
“resourcePath”: “string”,
“type”: “string”
}
],
“deletedResources”:[
{
“resourcePath”: “string”,
“type”: “string”
}
],
“updatedResources”:[
{
“resourcePath”: “string”,
“type”: “string”
}
],
“comment”: "string",
“email”: “string”,
“committerFullName”: “string”
}
Example to checkin
curl -X POST -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/checkin/{vcsInstanceName}}" -H "Content-Type: application/json" -d '{"comment": "my comment", "createdResources":[{"resourcePath":"/users/composite/admin/abc/foo", "type":"PROCEDURE"}], "updatedResources":[{"resourcePath":"/users/composite/admin/abc/bar", "type":"PROCEDURE"}], "deletedResources":[{"resourcePath":"/users/composite/admin/abc/kay", "type":"PROCEDURE"}]}'
GET /connection
This API is used to test connection by vcsAdapter name, url, username, password.
Parameters:
Name
Description
Parameter Type
Data Type
adapterName
Name of the adapter
query
string
url
 
header
string
user
 
header
string
password
 
header
string
base64Cer
It is an optional parameter used on git https with ssl certificate support.
for other usage, this can be Null.
query
string
Example to test connection by vcsAdapter name, url, username, password
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/connection?adapterName=svnAdapter&base64Cer={pem format certificate}" -H "Content-Type: application/json" -H "url:svn://172.23.5.76:3690" -H "user:svnuser1" -H "password:foa23f9u"
GET /connection/{name}
This API is used to verify vcs url connection.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to verify vcs url connection
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/connection/{vcsInstanceName}" -H "Content-Type: application/json"
GET /content/{name}
This API is used to get cmf content for special resource and revision in special vcsInstance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
resourceType
 
query
string
resourcePath
 
query
string
revision
 
query
string
Example to get cmf content for special resource and revision in special vcsInstance.
curl -X GET -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/content/{vcsInstanceName}?resourcePath=/users/composite/admin/abc/LookupProduct&resourceType=PROCEDURE&revision=r109" -H "Content-Type: application/json"
POST /discard/{name}
This API is used to discard local changes for special resource and get latest revision.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
includePrivileges
 
query
boolean
body
 
body
Model schema
Request Body
Example Value - Schema
{
“resources”:[
{
“resourcePath”: “string”,
“type”: “string”
}
]
}
Example to dicard local changes
curl -X POST -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/discard/{vcsInstanceName}?includePrivileges=true" -H "Content-Type: application/json" -d '{"resources":[{"resourcePath":"/users/composite/admin/def/LookupProduct", "type":"PROCEDURE"}]}'
GET /enable
This API is used to check whether vcs feature is enabled.
Parameters:
None
Example to check whether vcs feature is enabled
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/enable" -H "Content-Type: application/json"
POST /fetch/{name}
This API is used to fetch the resource subtree from a particular revision. For single resource(either a folder or a file), resource path and type should be provided. For vcs connection wide fetch, resource path and type should be set to null, (empty values for the resource path and type results in reader error currently).
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
revision
 
query
string
includePrivileges
 
query
boolean
body
 
body
Model schema
Request Body
Example Value - Schema
{
“resourcePath”: “string”,
“type”: “string”
}
Example to fetch the resource subtree from a particular revision.
curl -X POST -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/fetch/{vcsInstanceName}?revision=r112&includePrivileges=true" -H "Content-Type: application/json" -d”{"resourcePath":"/users/composite/admin/examples/view4", "type":"TABLE"}’
GET /history/{name}
This API is used to get whole history or history for special resource in special vcsInstance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
resourceType
 
query
string
resourcePath
 
query
string
Example to get whole history or history for special resource in special vcsInstance.
curl -X GET -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/history/{vcsInstnace}[?resourcePath=/users/composite/admin/abc/LookupProduct&resourceType=PROCEDURE]" -H "Content-Type: application/json"
GET /latestcontent/{name}
This API is used to get latest cmf content for special resource in special vcsInstance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
resourceType
 
query
string
resourcePath
 
query
string
Example to get latest cmf content for special resource in special vcsInstance.
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/latestcontent/{vcsInstanceName}?resourcePath=/users/composite/admin/abc/LookupProduct&resourceType=PROCEDURE" -H "Content-Type: application/json"
GET /localcontent/{name}
This API is used to get local cmf content for special resource in special vcsInstance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
resourceType
 
query
string
resourcePath
 
query
string
Example to get local cmf content for special resource in special vcsInstance.
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/localcontent/{vcsInstanceName}?resourcePath=/users/composite/admin/abc/LookupProduct&resourceType=PROCEDURE" -H "Content-Type: application/json"
GET /root
This API is used to check whether special path is a root in vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
cis_path
 
query
string
rootType
 
query
string
Example to check whether special path is a root in vcs instance.
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/root?cis_path=/users/composite/admin/abc/kkkdd&rootType={type}" -H "Content-Type: application/json"
GET /root/{name}
This API is used to get all of roots for special vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to get all of roots for special vcs instance
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/root/{vcsInstanceName}}" -H "Content-Type: application/json"
POST /root/{name}
This API is used to add root for special vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
mode
 
query
string
rootType
 
query
string
includePriveleges
 
query
boolean
body
 
body
string
Example to add root for special vcs instance
curl -X POST -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/root/{vcsInstanceName}?mode={push/pull}&includePrivileges=true&rootType={type}" -H "Content-Type: application/json" -d "/users/composite/admin/gitabc"
DELETE /root/{name}
This API is used to delete root from special vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
cis_path
 
query
string
rootType
 
query
string
Example to delete root from special vcs instance
curl -X DELETE -u admin:admin "http://localhost:9400/rest/vcs/v1/root/{vcsInstanceName}?cis_path=/users/composite/admin/abc&rootType={type}" -H "Content-Type: application/json"
POST /setCredential/{name}
This API is used to set credial for the vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
body
 
body
Model schema
Request Body
Example Value - Schema
{
“username”: “string”,
“password”: “string”
}
Example to set credential
curl -X POST -u admin:admin --cookie "session9400={sessionToken}" "http://localhost:9400/rest/vcs/v1/setCredential/{vcsInstanceName}}" -H "Content-Type: application/json" -d '{"username":"gituser2", "password":"foa23f9u"}'
GET /status/{name}
This API is used to get resource status for special vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to get resource status for special vcs instance
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/status/{vcsInstanceName}}" -H "Content-Type: application/json"
GET /vcsAdapter/{adapter_name}
This API is used to get VCS adapter by adapter name.
Parameters:
Name
Description
Parameter Type
Data Type
adapterName
name of the adapter
path
string
Example to Get VCS adapter by adapter name
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsAdapter/{adapterName}" -H "Content-Type: application/json"
GET /vcsAdapters
This API is used to get VCS adapters.
Parameters:
None
Example to get VCS adapters
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsAdapters" -H "Content-Type: application/json"
POST /vcsInstance
This API is used to create vcs instance.
Parameters:
None
Request Body
Example Value - Schema
{
“cmdCheckIn”: “string”,
“cmdCheckOut: “string”,
“cmdAdd”: “string”,
“cmdRemove”: “string”,
“cmdRevert”: “string”,
“cmdStatus”: “string”,
“cmdDiff”: “string”,
“name”: “string,
“description”: “string”,
“providerId”: “string”,
“repository”: “string”,
“localWorkspace”: “string”,
“encryptionPassword”, “string”,
“branch”, “string”,
“ignoreEncryption”: “string”,
“base64Cer”: “string”,
“cmdHistory”: “string”
}
Example to create vcs instance
curl -X POST -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsInstance" -H "Content-Type: application/json" -d '{"name":"vcssource1", "description": "dd", "providerId":"svnAdapter", "repository": "svn://172.23.5.76:3690/project6", "branch":"master", "encryptionPassword":"testPassword", "base64Cer":"Pem format certificate" }'
GET /vcsInstance/{name}
This API is used to get vcs instance by name.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to get vcs instance by name
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsInstance/{vcsInstanceName}" -H "Content-Type: application/json"
PUT /vcsInstance/{name}
This API is used to update vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Request Body
Example Value - Schema
{
“cmdCheckIn”: “string”,
“cmdCheckOut: “string”,
“cmdAdd”: “string”,
“cmdRemove”: “string”,
“cmdRevert”: “string”,
“cmdStatus”: “string”,
“cmdDiff”: “string”,
“name”: “string,
“description”: “string”,
“providerId”: “string”,
“repository”: “string”,
“localWorkspace”: “string”,
“encryptionPassword”, “string”,
“branch”, “string”,
“ignoreEncryption”: “string”,
“base64Cer”: “string”,
“cmdHistory”: “string”
}
Example to update vcs instance
curl -X PUT -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsInstance/{vcsInstanceName}" -H "Content-Type: application/json" -d '{"description": "dddddd", "providerId":"svnAdapter", "repository": "svn://172.23.5.76:3690", "branch":"master", "encryptionPassword":"testPassword", "base64Cer":"Pem format certificate" }'
DELETE /vcsInstance/{name}
This API is used to delete vcs instance.
Parameters:
Name
Description
Parameter Type
Data Type
name
 
path
string
Example to delete vcs instance
curl -X DELETE -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsInstance/{vcsInstanceName}" -H "Content-Type: application/json"
GET /vcsInstances
This API is used to get all vcs instances.
Parameters:
None
Example to get all vcs instances
curl -X GET -u admin:admin "http://localhost:9400/rest/vcs/v1/vcsInstances" -H "Content-Type: application/json"