Get Started

REST API

Shared daemon REST API

Chapter 1. Rest API Server

SubGit shared daemon process supports REST API requests by providing several REST API endpoints. This feature is available since SubGit version 3.3.4.

By default, when configured for the very first time, REST server accepts HTTP requests on port 8990.

Following configuration options are supported in the shared_daemon/config file:

[http]
# required for REST API to be enabled
port = 8990

# optional configuration options
host = 0.0.0.0
path = subgit

With the configuration above, REST API endpoints will be available at http://hostname:8990/subgit/rest/ENDPOINT_NAME. To apply configuration changes, restart shared daemon by running

$ subgit daemon start shared/daemon/path

To disable REST API, remove or comment out http.port option and run

$ subgit daemon start shared/daemon/path

to apply changes.

up

Chapter 2. Version

Reports version of SubGit shared daemon process.

GET subgit/rest/version

Command:

$ curl http://host:8990/subgit/rest/version

Sample output:

{
   "version" : "3.3.5",
   "buildNumber" : "4042"
}

up

Chapter 3. Poll

Fetches new changes from SVN to Git repositories managed by this shared daemon. When SVN UUID is specified, Git repositories are limited to those that mirrors SVN repositories with that UUID.

POST subgit/rest/poll[?svnUuid=UUID]

Command:

$ curl -X POST -H "Content-Type: application/json" http://host:8990/subgit/rest/poll

Sample output:

{
  "gitRepositories" : [ 
  {
    "gitRepositoryPath" : "/path/to/repo1.git",
    "svnUuid" : "ad8246cb-9636-44d0-bfd6-4ad6331e00cf",
    "translatedRevisions" : [ ],
    "updatedRefs" : [ ],
    "status" : "ok"
  }, 
  {
    "gitRepositoryPath" : "/path/to/repo2.git",
    "svnUuid" : "7c25a367-8d99-43a9-b3e8-d37544e1b6d3",
    "translatedRevisions" : [ {
      "commitId" : "d194130f9ddc7c2a7ae61294f026fa77000da398",
      "revision" : "19"
    } ],
    "updatedRefs" : [ {
      "ref" : "refs/heads/master",
      "newObjectId" : "d194130f9ddc7c2a7ae61294f026fa77000da398",
      "oldObjectId" : "8a7f68f30d3ad5a99ba70ff50d9d3c9db1f64b66"
    } ],
    "status" : "ok"
  } ]
}

up

Chapter 4. Map

Reports effective SVN/Git mapping either for VCS authors or paths.

POST subgit/rest/map

Command:

$ curl -X POST -H "Content-Type: application/json" http://host:8990/subgit/rest/map

Input data:

{
   "author": "svnUser | Git Author <author@mail>"  
}

OR

{
   "paths": [ "refs/heads/master", "path", "svnURL" ...]
}

Sample authors output:

{
  "mappings" : [ 
  {
    "gitAuthor" : "Alex <kitaev@tmatesoft.com>",
    "gitRepositoryPath" : "/path/to/repo1.git",
    "svnAuthor" : "alex"
  }, 
  {
    "gitAuthor" : "alex <alex@yahoo.com>",
    "gitRepositoryPath" : "/path/to/repo2.git",
    "svnAuthor" : "alex"
  } 
  ]
}

Sample paths output:

{
  "mappings" : 
  [ 
  {
    "gitPath" : "",
    "gitRef" : "refs/heads/master",
    "gitRepositoryPath" : "/path/to/repo1.git",
    "svnUrl" : "https://svn.tmatesoft.com/repos/test/trunk",
    "svnPath" : "trunk",
    "svnLocationUrl" : "https://svn.tmatesoft.com/repos/test"
  }, 
  {
    "gitPath" : "",
    "gitRef" : "refs/heads/master",
    "gitRepositoryPath" : "/path/to/repo2.git",
    "svnUrl" : "svn://192.168.9.12/test/trunk",
    "svnPath" : "trunk",
    "svnLocationUrl" : "svn://192.168.9.12/test"
  } 
  ]
}

up

Contact us

Please fill out all fields.


By clicking on this button you agree to provide us your personal data for the purpose of technical support for you. Please read our Privacy policy for more details.

Thank you for contacting us!
We will get back to you soon.

We are sorry, something went wrong. Please try again or contact us.