@PLUGIN@ - /config/ REST API

This page describes the REST endpoints that are added by the @PLUGIN@ plugin.

Please also take note of the general information on the REST API.

Importer Endpoints

Import Project

PUT /config/server/@PLUGIN@~projects/{project-name}

Imports a project.

Information about the project import must be provided in the request body as a ImportProjectInput entity.

Caller must be a member of a group that is granted the ‘Import’ capability (provided by this plugin) or the ‘Administrate Server’ capability.

Request

  PUT /config/server/@PLUGIN@~projects/myProject HTTP/1.0
  Content-Type: application/json;charset=UTF-8

  {
    "from": "https://some-gerrit-server:8080",
    "user": "myUser",
    "pass": "myPassword"
  }

As result a ImportStatisticInfo entity is returned.

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "num\_changes\_created": 5
  }

List Imported Projects

GET /config/server/@PLUGIN@~projects/

Lists the imported projects.

Caller must be a member of a group that is granted the ‘Import’ capability (provided by this plugin) or the ‘Administrate Server’ capability.

It is possible to filter the list of imported projects using the match option. The response will include only those projects whose name contains the given match substring, case insensitive.

Request

  GET /config/server/@PLUGIN@~projects/?match=my HTTP/1.0

As result a map is returned that maps the project name to ImportProjectInfo entity.

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "myProject": {
      "from": "http://localhost:8081/",
      "name": "myProject",
      "imports": [
        {
          "timestamp": "2015-03-11 09:14:21.748000000",
          "user": {
            "_account_id": 1000000,
            "name": "Administrator",
            "email": "edwin.kempin@gmail.com",
            "username": "admin"
          },
          "remote_user": "admin"
        }
      ]
    },
    "myProject2": {
      "from": "http://localhost:8081/",
      "name": "projectToBeRenamed",
      "imports": [
        {
          "timestamp": "2015-03-11 09:16:04.511000000",
          "user": {
            "_account_id": 1000000,
            "name": "Administrator",
            "email": "edwin.kempin@gmail.com",
            "username": "admin"
          },
          "remote_user": "admin"
        }
      ]
    }
  }

Get Imported Project

GET /config/server/@PLUGIN@~projects/{project-name}

Gets information about the imports of a project.

As result a ImportProjectInfo entity is returned.

Caller must be a member of a group that is granted the ‘Import’ capability (provided by this plugin) or the ‘Administrate Server’ capability.

Request

  GET /config/server/@PLUGIN@~projects/myProject HTTP/1.0

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "from": "http://localhost:8081/",
    "name": "myProject",
    "imports": [
      {
        "timestamp": "2015-03-11 09:14:21.748000000",
        "user": {
          "_account_id": 1000000,
          "name": "Administrator",
          "email": "edwin.kempin@gmail.com",
          "username": "admin"
        },
        "remote_user": "admin"
      }
    ]
  }

Resume Project Import

PUT /config/server/@PLUGIN@~projects/{project-name}/resume

Resumes a project import.

Information about the import resume must be provided in the request body as a ImportResumeInput entity.

Caller must be a member of a group that is granted the ‘Import’ capability (provided by this plugin) or the ‘Administrate Server’ capability.

Request

  PUT /config/server/@PLUGIN@~projects/myProject/resume HTTP/1.0
  Content-Type: application/json;charset=UTF-8

  {
    "user": "myUser",
    "pass": "myPassword"
  }

As result a ResumeImportStatisticInfo entity is returned.

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "num\_changes\_created": 1,
    "num\_changes\_updated": 2
  }

Import Group

PUT /config/server/@PLUGIN@~groups/{group-name}

Imports a group.

Information about the group import must be provided in the request body as a ImportGroupInput entity.

Caller must be a member of a group that is granted the ‘Import’ capability (provided by this plugin) or the ‘Administrate Server’ capability.

Request

  PUT /config/server/@PLUGIN@~groups/myGroup HTTP/1.0
  Content-Type: application/json;charset=UTF-8

  {
    "from": "https://some-gerrit-server:8080",
    "user": "myUser",
    "pass": "myPassword"
  }

Complete Project Import

DELETE /config/server/@PLUGIN@~projects/{project-name}

Mark a project import as completed.

Once a project import is completed it cannot be resumed any more.

Request

  DELETE /config/server/@PLUGIN@~projects/myProject HTTP/1.0

Response

  HTTP/1.1 204 No Content

JSON Entities

ImportGroupInput

The ImportGroupInput entity contains information about a group import.

  • from: URL of the remote system from where the group should be imported.
  • user: User on remote system.
  • pass: Password of remote user.
  • import_owner_group: Whether missing owner groups should be imported automatically (by default false).
  • import_included_groups: Whether missing included groups should be imported automatically (by default false).

ImportInfo

The ImportInfo entity contains information about a past import.

  • timestamp: The timestamp of when the import was done.
  • user: User that did the import as a detailed link:../../../Documentation/rest-api-accounts.html#account-info[AccountInfo] entity.
  • remote_user: User on remote system.

ImportProjectInfo

The ImportProjectInfo entity contains information about the past imports of a project.

  • from: (Optional) URL of the remote system from where the project should be imported (not set if it is a project copy within one Gerrit server).
  • name: Name of the project in the source system.
  • parent: (Optional) Name of the parent project in the target system.
  • imports: List of past imports as ImportInfo entities.

ImportProjectInput

The ImportProjectInput entity contains information about a project import.

  • from: URL of the remote system from where the project should be imported.
  • name: (Optional) Name of the project in the source system. If not specified it is assumed to be the same name as in the target system.
  • user: User on remote system.
  • pass: Password of remote user.
  • parent: (Optional) Name of the parent project in the target system. The imported project will be created under this parent project.

ImportResumeInput

The ImportResumeInput entity contains information about an import resume.

  • user: User on remote system.
  • pass: Password of remote user.
  • force: Whether the resume should be done forcefully. On resume with force changes that have the same last modified timestamp in the source and target system are resumed, otherwise they will be skipped.

ImportStatisticInfo

The ImportStatisticInfo entity contains statistics about a project import.

  • num_changes_created: Number of created changes.

ResumeImportStatisticInfo

The ResumeImportStatisticInfo entity contains statistics about a project import resume.

  • num_changes_created: Number of created changes.
  • num_changes_updated: Number of updated changes.

SEE ALSO

GERRIT

Part of Gerrit Code Review