Source Code Management Servers
This chapter is managed on source code management servers.
Get all scm servers
A GET
to /scm-servers
returns all the source code management servers.
HTTP request
GET /api/rest/latest/scm-servers HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which attributes of the returned entities should be sorted on (optional) |
|
which fields of the elements should be returned (optional) |
|
which type of the element should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1125
{
"_embedded" : {
"scm-servers" : [ {
"_type" : "scm-server",
"id" : 1,
"name" : "server1",
"url" : "https://github.com/",
"kind" : "git",
"committer_mail" : "henix@git.fr",
"authentication_policy" : "USER",
"authentication_protocol" : "BASIC_AUTH",
"repositories" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/1"
}
}
}, {
"_type" : "scm-server",
"id" : 2,
"name" : "server2",
"url" : "https://bitbucket.org/",
"kind" : "git",
"committer_mail" : "henix@git.fr",
"authentication_policy" : "USER",
"authentication_protocol" : "BASIC_AUTH",
"repositories" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/2"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the list of elements for that page |
|
|
the page size for that query |
|
|
total number of elements |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Get scm server
A GET
to /scm-servers/{id}
returns the source code management server with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the source code management server |
HTTP request
GET /api/rest/latest/scm-servers/1 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 692
{
"_type" : "scm-server",
"id" : 1,
"name" : "server1",
"url" : "https://github.com/",
"kind" : "git",
"committer_mail" : "henix@git.fr",
"authentication_policy" : "USER",
"authentication_protocol" : "BASIC_AUTH",
"repositories" : [ {
"_type" : "scm-repository",
"id" : 9,
"name" : "GherkinTestCase",
"repository_path" : "home/Git1",
"working_folder_path" : "resources/features",
"working_branch" : "master",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-repositories/9"
}
}
} ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/1"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the id of the source code management server |
|
|
the name of the source code management server |
|
|
the url of the source code management server |
|
|
the kind of the source code management server |
|
|
the committer mail used for the source code management server |
|
|
the authentication policy of the source code management server |
|
|
the authentication protocol of the source code management server |
|
|
the repositories of this source code management server |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this source code management server |
Create scm server
A POST
to /scm-servers
creates a new source code management server.
HTTP request
POST /api/rest/latest/scm-servers HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 118
Host: localhost:8080
{
"name" : "New scmServer",
"url" : "https://github.com/",
"kind" : "git",
"committer_mail" : "henix@git.fr"
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the name of the source code management server (mandatory) |
|
|
the url of the source code management server (mandatory) |
|
|
the kind of the source code management server (mandatory) |
|
|
the committer mail used for the source code management server |
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 698
{
"_type" : "scm-server",
"id" : 1,
"name" : "New scmServer",
"url" : "https://github.com/",
"kind" : "git",
"committer_mail" : "henix@git.fr",
"authentication_policy" : "USER",
"authentication_protocol" : "BASIC_AUTH",
"repositories" : [ {
"_type" : "scm-repository",
"id" : 9,
"name" : "GherkinTestCase",
"repository_path" : "home/Git1",
"working_folder_path" : "resources/features",
"working_branch" : "master",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-repositories/9"
}
}
} ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/1"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the id of the source code management server |
|
|
the name of the source code management server |
|
|
the url of the source code management server |
|
|
the kind of the source code management server |
|
|
the committer mail used for the source code management server |
|
|
the authentication policy of the source code management server |
|
|
the authentication protocol of the source code management server |
|
|
the repositories of this source code management server |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this source code management server |
Modify scm server
A PATCH
to /scm-servers/{id}
modifies the source code management server with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the source code management server |
HTTP request
PATCH /api/rest/latest/scm-servers/2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 106
Host: localhost:8080
{
"name" : "update scmServer",
"url" : "https://bitbucket.org/",
"committer_mail" : "git@henix.fr"
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the name of the source code management server |
|
|
the url of the source code management server |
|
|
the committer mail used for the source code management server |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 376
{
"_type" : "scm-server",
"id" : 2,
"name" : "update scmServer",
"url" : "https://bitbucket.org/",
"kind" : "git",
"committer_mail" : "git@henix.fr",
"authentication_policy" : "USER",
"authentication_protocol" : "BASIC_AUTH",
"repositories" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/2"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the id of the source code management server |
|
|
the name of the source code management server |
|
|
the url of the source code management server |
|
|
the kind of the source code management server |
|
|
the committer mail used for the source code management server |
|
|
the authentication policy of the source code management server |
|
|
the authentication protocol of the source code management server |
|
|
the repositories of this source code management server |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this source code management server |
Delete scm server
A DELETE
to /scm-servers/{ids}
deletes one or several source code management servers with the given id(s).
Path parameters
Parameter | Description |
---|---|
|
the list of ids of the source code management servers |
HTTP request
DELETE /api/rest/latest/scm-servers/11,12 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
HTTP response
HTTP/1.1 204 No Content
Get all scm repositories from the scm server
A GET
to /scm-servers/{id}/scm-repositories
returns all the source code management repository for the scm server.
HTTP request
GET /api/rest/latest/scm-servers/11/scm-repositories HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which attributes of the returned entities should be sorted on (optional) |
|
which fields of the elements should be returned (optional) |
|
which type of the element should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1726
{
"_embedded" : {
"scm-repositories" : [ {
"_type" : "scm-repository",
"id" : 1,
"name" : "GherkinTestCase",
"repository_path" : "home/Git1",
"working_folder_path" : "resources/features",
"working_branch" : "master",
"scm_server" : {
"_type" : "scm-server",
"id" : 11,
"name" : "scmServer",
"url" : "https://bitbucket.org/",
"kind" : "git",
"committer_mail" : "git@henix.fr",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/11"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-repositories/1"
}
}
}, {
"_type" : "scm-repository",
"id" : 2,
"name" : "StandardTestCase",
"repository_path" : "home/Git2",
"working_folder_path" : "resources/features",
"working_branch" : "master",
"scm_server" : {
"_type" : "scm-server",
"id" : 11,
"name" : "scmServer",
"url" : "https://bitbucket.org/",
"kind" : "git",
"committer_mail" : "git@henix.fr",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/11"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-repositories/2"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/11/scm-repositories?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the list of elements for that page |
|
|
the page size for that query |
|
|
total number of elements |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Add a scm repository to a scm server
A POST
to /scm-servers/{id}/scm-repositories
creates a new source code management repository for the given scm server id .
HTTP request
POST /api/rest/latest/scm-servers/9/scm-repositories HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 196
Host: localhost:8080
{
"name" : "GherkinTestCase",
"working_branch" : "master",
"repository_path" : "home/Git1",
"working_folder_path" : "resources/features",
"params" : {
"clone_repository" : true
}
}
Path parameters
Parameter | Description |
---|---|
|
the id of the source code management server |
Request fields
Path | Type | Description |
---|---|---|
|
|
the name of the source code management repository (mandatory) |
|
|
the repository path of the source code management repository (mandatory if cloning) |
|
|
the working folder path of the source code management repository |
|
|
the working branch of the source code management repository (mandatory) |
|
|
the parameters to create a new source code management repository |
|
|
whether the repository must be cloned on squash server file system |
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 618
{
"_type" : "scm-repository",
"id" : 1,
"name" : "GherkinTestCase",
"repository_path" : "home/Git1",
"working_folder_path" : "resources/features",
"working_branch" : "master",
"scm_server" : {
"_type" : "scm-server",
"id" : 9,
"name" : "server1",
"url" : "https://github.com/",
"kind" : "git",
"committer_mail" : "henix@git.fr",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/9"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/9/scm-repositories"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the id of the source code management repository |
|
|
the name of the source code management repository |
|
|
the repository path of the source code management repository |
|
|
the working folder path of the source code management repository |
|
|
the working branch of the source code management repository |
|
|
the scm server this source code management repository belongs to |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this source code management repository |
Get scm server credentials
A GET
to /scm-servers/{id}/credentials
get the credentials for the given source code management server.
HTTP request
GET /api/rest/latest/scm-servers/1/credentials HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Path parameters
Parameter | Description |
---|---|
|
the id of the scm server |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 194
{
"_type" : "basic-auth-credentials",
"username" : "user@henix.fr",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/1/credentials"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the credentials |
|
|
the username to authenticate to this scm server |
|
|
related links |
Set scm server credentials
A POST
to /scm-servers/{id}/credentials
set credentials for the given source code management server.
-
Set basic authentication credentials
HTTP request
POST /api/rest/latest/scm-servers/1/credentials HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 106
Host: localhost:8080
{
"_type" : "basic-auth-credentials",
"username" : "user@henix.fr",
"password" : "qcrGmkQxI0J789F"
}
Path parameters
Parameter | Description |
---|---|
|
the id of the scm server |
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of the credentials |
|
|
the username to authenticate to this scm server |
|
|
the password to authenticate to this scm server |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 194
{
"_type" : "basic-auth-credentials",
"username" : "user@henix.fr",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/1/credentials"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the credentials |
|
|
the username to authenticate to this scm server |
|
|
related links |
-
Set token authentication credentials
HTTP request
POST /api/rest/latest/scm-servers/3/credentials HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 82
Host: localhost:8080
{
"_type" : "token-auth-credentials",
"token" : "glpat-yCJ8-ixVcExazMi3Ky3Q"
}
Path parameters
Parameter | Description |
---|---|
|
the id of the scm server |
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of the credentials |
|
|
the token to authenticate to this scm server |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 162
{
"_type" : "token-auth-credentials",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/scm-servers/3/credentials"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the credentials |
|
|
related links |