XP-Dev.com Documentation

Repositories API

This user guide only applies if your account and project is on our new platform, i.e. if your project's URL begins with https://<your-account>.xp-dev.com rather than https://xp-dev.com. If your account is on our old platform, you should be using this user guide instead.

Each Repository Object has the following attributes:

Attribute Description
id Unique repository ID
project The project ID that the repository belongs to
name A unique repository name
type Repository type, either Subversion, Mercurial or Git
minimumCommentLength The minimum characters that all comments during check-ins should have
allowRevisionPropertyChanges Subversion only: allow repository revision property changes
allowedIpAddresses List of IP Addresses that are access to this repository is restricted to
noDiffsInCommitEmails Do not include diff changes in commit emails
commitEmails List of emails addresses to send commit emails to
directFileHosting Turn on Direct File Hosting (serving repository as a static website)
commitEmailsSubject Format template for commit emails
commitEmailsPlainText Whether to send commit emails as plain text (rather than HTML)
transports A list of Transport Objects
size Size of the repository

Each Transport Object has the following attributes:

Attribute Description
type Either HTTP, HTTPS, SSH or WebDAV
url The url for the repository using the specified transport type

Each Path Based Permissions Object has the following attributes:

Attribute Description
repositoryId The repository ID that the path based permission belongs to
pathPermissions Content of the authorization file for mod_authz_svn

Create a New Repository

POST call to https://<your-account>.xp-dev.com/api/v1/repositories with the following attributes:

Mandatory:

  • project
  • name
  • type
  • createInitialDirectories (boolean)

Example request:

curl -X POST -H 'Content-Type: application/json' -d '{"project":{"id": 168}, "name":"ansvnrepository","type":"Subversion","createInitialDirectories":false}' https://<your-account>.xp-dev.com/api/v1/repositories

Responses will be a single Repository object.

For example:

{
    "id": 1,
    "name": "ansvnrepository",
    "type": "Subversion",
    "project": {
      "id": 168
    },
    "minimumCommentLength": 0,
    "allowRevisionPropertyChanges": false,
    "commitEmails": null,
    "commitEmailsSubject": "{1} repository [{0}] commit notification",
    "commitEmailsPlainText": false,
    "allowedIpAddresses": null,
    "transports": [
      {
        "type": "HTTPS",
        "url": "https://<your-account>.xp-dev.com/svn/ansvnrepository"
      },
      {
        "type": "WebDAV",
        "url": "https://<your-account>.xp-dev.com/svn/ansvnrepository"
      }
    ],
    "directFileHosting": false,
    "noDiffsInCommitEmails": false,
    "size": 0.0
},

List all Repositories

GET request to https://<your-account>.xp-dev.com/api/v1/repositories:

curl https://<your-account>.xp-dev.com/api/v1/repositories

Responses will be a list of Repository Objects

List all Repositories for a Project

GET request to https://<your-account>.xp-dev.com/api/v1/repositories/project/<project-id>:

curl https://<your-account>.xp-dev.com/api/v1/repositories/project/168

Responses will be a list of Repository Objects

Get a Single Repository

GET call to https://<your-account>.xp-dev.com/api/v1/repositories/<repository-id>. For example:

curl https://<your-account>.xp-dev.com/api/v1/repositories/136

Responses will be a single Repository Object

Update a Single Repository

PUT call to https://<your-account>.xp-dev.com/api/v1/repositories/<repository-id> with the following attributes:

Mandatory:

  • name
  • minimumCommentLength
  • allowRevisionPropertyChanges
  • noDiffsInCommitEmails
  • commitEmails (list)
  • directFileHosting
  • project
  • commitEmailsSubject
  • commitEmailsPlainText
  • allowedIpAddresses

Example request:

curl -X PUT -d '{"name":"slavetest","commitEmails":["a@a.com", "b@b.com"],"commitEmailsPlainText":false,"commitEmailsSubject":"{1} repository [{0}] commit notification","project":{"id": 126},"minimumCommentLength":0,"allowRevisionPropertyChanges":false,"noDiffsInCommitEmails":false,"directFileHosting":false, "allowedIpAddresses": "192.168.0.1"}' -H 'Content-Type: application/json' https://<your-account>.xp-dev.com/api/v1/repositories/150

Responses will be a single Repository Object

Delete a Repository

DELETE request to https://<your-account>.xp-dev.com/api/v1/repositories/<repository-id>:

curl -X DELETE https://<your-account>.xp-dev.com/api/v1/repositories/150

Get Path Based Permissions for a Subversion Repository

GET request to https://<your-account>.xp-dev.com/api/v1/repositories/path-permissions/<repository-id>:

curl https://<your-account>.xp-dev.com/api/v1/repositories/path-permissions/182

Responses will be a single Path Based Permissions Object

For example:

{
    "response":{
        "repositoryId":51,
        "pathPermissions":"[groups]\nharry_and_sally = harry,sally \nharry_sally_and_joe = harry,sally,&joe"
    }
}

Update Path Based Permissions for a Subversion Repository

PUT call to https://<your-account>.xp-dev.com/api/v1/repositories/path-permissions/<repository-id> with the following attributes:

Mandatory:

  • pathPermissions

Example request:

curl -X PUT -d '{"pathPermissions":"[groups]\nharry_and_sally = harry,sally \nharry_sally_and_joe = harry,sally,&joe"}' -H 'Content-Type: application/json' https://<your-account>.xp-dev.com/api/v1/repositories/path-permissions/190

Responses will be a single Path Based Permissions Object

Feel free to contact us if you need any assistance.