To create a Git repository, use the create operation.

Request Packet Structure

A request XML packet creating a Git repository on a domain, includes the create operation node:

<packet>
  <extension>
    <call>
      <git>
        <create>
          ...
        </create>
      </git>
    </call>
  </extension>
</packet>

The create node has the following structure:

  • The domain node is required. It specifies the domain where the repository should be created. Data type: string.
  • The name node is required. It specifies the name of a new repository. Data type: string.
  • The deployment-path node is optional. It specifies the path where the files from the repository should be deployed. Data type: string.
  • The deployment-mode node is optional. It specifies the deployment mode (auto, manual, or none). Data type: string.
  • The remote-url node is optional. It specifies the URL of a remote repository and is used for a repository of the Using remote Git hosting type only. Data type: string.
  • The skip-ssl-verification node is optional. It specifies if SSL/TLS verification should be disabled when pulling data from the remote repository. This is applicable for a repository of the Using remote Git hosting type only. Data type: boolean.
  • The actions node is optional. It specifies the list of additional actions that will be performed each time when the files are deployed to the web site. The actions are shell commands delimited by “;” symbol that should be used with an escape character: “&gt;”. Data type: string.

Response Packet Structure

The output XML packet is structured as follows:

<packet>
  <extension>
    <call>
      <result>
        <status>...</status>
        ...
        <git>
          <create>
            <repository>
            ...
            </repository>
          </create>
        </git>
      </result>
    </call>
  </extension>
</packet>
  • The result node is required. It wraps the response received from the server. This node contains the following nodes:
    • The status node is required. It specifies the execution status of the create operation. Data type: result_status. Allowed values: ok | error.
    • The errcode node is optional. It is used to return the error code when the create operation fails. Data type: unsignedInt.
    • The errtext node is optional. It is used to return the error message if the create operation fails. Data type: string.
    • The git node is optional. It contains information about the created repository. This node contains the required create node that includes a repository node containing settings of the created repository. This node contains the following nodes:
      • The uid node is required. It specifies the unique identifier of the repository. Data type: string.
      • The domain node is required. It specifies the domain. Data type: string.
      • The name node is required. It specifies the repository name. Data type: string.
      • The deployment-path node is optional. It specifies the deployment path of the repository. Data type: string.
      • The deployment-mode node is optional. It specifies if the automatic deployment mode is used (auto, manual, or none). Data type: string.
      • The url node is optional. It specifies the URL of the repository of the Using local repository type. Data type: string.
      • The remote-url node is optional. It specifies the URL of the remote repository for a repository of the Using remote Git hosting type. Data type: string.
      • The webhook-url node is optional. It specifies the webhook URL that should be set in a remote repository settings for automatic pulling data for a repository of the Using remote Git hosting type. Data type: string.
      • The skip-ssl-verification node is optional. It specifies if SSL/TLS verification of a remote repository is switched on or off during pulling the data to a repository of the Using remote Git hosting type. Data type: boolean.
      • The public-key node is optional. It specifies the public-key that should be added to a remote repository settings for a repository of the Using remote Git hosting type. Data type: string.
      • The active-branch node is optional. It specifies the name of the active branch of the repository. Data type: string.
      • The last-commit node is optional. It specifies the information on the last commit. Data type: string.
      • The actions node is optional. It specifies the list of additional deployment actions. Data type: string.

Samples

Creating a repository using local repository on your workstation

This packet creates a repository of the Using local repository on your workstation type, sets the name, the deployment mode and the deployment path, and the additional actions.

<packet>
  <extension>
    <call>
      <git>
        <create>
          <domain>example.com/domain>
          <name>repo1</name>
          <deployment-mode>auto</deployment-mode>
          <deployment-path>httpdocs</deployment-path>
          <actions>ls &gt; data.txt</actions>
        </create>
      </git>
    </call>
  </extension>
</packet>

Response:

<packet>
  <extension>
    <call>
      <result>
        <status>ok</status>
        <git>
          <create>
            <repository>
              <uid>4ee69d1c-10a4-bc48-dda7-aab486467e0f</uid>
              <domain>example.com</domain>
              <name>repo1</name>
              <deployment-path>httpdocs</deployment-path>
              <deployment-mode>auto</deployment-mode>
              <url>user_1@example.com:~/git/repo1</url>
              <actions>ls &gt; data.txt</actions>
            </repository>
          </create>
        </git>
      </result>
    </call>
  </extension>
</packet>

Creating a repository using remote Git hosting

This packet creates a repository of the Using remote Git hosting type.

<packet>
  <extension>
    <call>
      <git>
        <create>
          <domain>domain.com</domain>
          <name>repo2</name>
          <remote-url>http://https://github.com/user1/demo.git</remote-url>
        </create>
      </git>
    </call>
  </extension>
</packet>

Response:

<packet>
  <extension>
    <call>
      <result>
        <status>ok</status>
        <git>
          <create>
            <repository>
              <uid>1eeaf7ec-0743-3965-3483-c5bdbcd2c9a6</uid>
              <domain>domain.com</domain>
              <name>repo2</name>
              <deployment-path>httpdocs</deployment-path>
              <deployment-mode>none</deployment-mode>
              <remote-url>http://https://github.com/user1/demo.git</remote-url>
              <webhook-url>https://ppu17-0.demo.pp.plesk.ru:8443/smb/web-hook/git/uuid/34125084-6781-2b7d-ca5c-0ee503fee5bc</webhook-url>
              <skip-ssl-verification>false</skip-ssl-verification>
              <public-key>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCfPjFbmlvU6YksMJy9na6BUuBlaX4Fje6IQh3l2BUA+hnVrnm8YVNCIPCKJWdGB6fUII+ENw3t81GYPbUERA52Y/IjwZtcYlpoBwTWKF89HWWmcHXHTpAqbIkTqMkZeZ6vFu42rXphH5KvoXVasqoxHNX9UR6qL7+XZThSOTR2PAB9avF+UgasvsSIb9zxwdjCcouJk+BGOoQMSGNEiNUDlWaabhp+CekuVt9zEXrsCM9ceR0iP7AT87l8iWquAInxYWRtCrcuB6Qe+443O/5uBs2l91EdJBdpk2M/eqeXEKiTCvVP56ANt2R+sR9A2ty5J2sj33wFQmif6vpf/mZD1EKczqwfJlHpkKk9rCGL5UGy1SKqYcHGD+5BJpHYf8iZbMKVkSv9VVjVtwWxAhQL5Nh/lMT0WKZVamaWfQRmKiHuTnX6H3DimBnVoG3h3KOcasELqwU7UUK8Q+6G253YTRZcpyhVSqasfQT2bjHZxBCs769LfbNT7pLX3ETFWsh6vFJnelPRlQ/v4rvi5deNpiRIlhvuCrq6Xf04sQFrZNC4y9h9o+PkAB6bNjxPr+rEiSyyaBfLyDOEZq7/XwVcyVt+dBFV0y2U4OhazRkdSks3TX57ruG6HfaX2pcMp1WWbNsuX05xFrGda+Vj+/oYLW5uqCypyGlIA82gNOSpKw==</public-key>
              <active-branch>master</active-branch>
              <last-commit>commit 15505af5e2c70d7c261bd267a9750f63ab4aa18d
Merge: 788af09 faa7270
Author: John Doe <john@somemail.com>;
Date:   Wed Feb 24 08:45:49 2016 +0600

    Merge branch 'master' of /home/git/repositories/demo
</last-commit>
            </repository>
          </create>
        </git>
      </result>
    </call>
  </extension>
</packet>