The import-package operation is used to import to Plesk an application package uploaded to the server.

Request Packet Structure

A request XML packet importing APS package to the Plesk contains the import-package operation node:

<packet>
    <aps>
        <import-package>
            ...
        </import-package>
    </aps>
</packet>

The import-package node is structured as follows:

image 63552

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/agent_input.svg.

  • filename, required

    Specifies the name of the application package uploaded to the server. Data type: string.

    Value should be the temporary file name returned in the upload response (in the "upload/result/file" element).

Response Packet Structure

The import-package node of the output XML packet is structured as follows:

image 63553

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/agent_output.svg.

  • result, required

    Wraps the response retrieved from the server. Data type: resultType (common.xsd).

  • status, required

    Specifies the execution status of the operation. Data type: string. Allowed values: ok | error.

  • errcode, required if the operation fails

    Returns the error code. Data type: integer.

  • errtext, required if the operation fails

    Returns the error message. Data type: string.

  • package-id, required if the operation succeeds

    Returns the ID assigned to the package on the Plesk-managed server. Data type: id_type (common.xsd).

Samples

Request packets importing to Plesk the APS package previously uploaded to the server looks as follows.

On Linux/Unix:

<packet>
    <aps>
        <import-package>
            <filename>/usr/local/psa/tmp/li_8FZruf</filename>
        </import-package>
    </aps>
</packet>

On Windows:

<packet>
    <aps>
        <import-package>
            <filename>"C:/Program Files/Parallels/Plesk/tmp/li_9D.tmp"</filename>
        </import-package>
    </aps>
</packet>

 Response:

<packet>
    <aps>
        <import-package>
            <result>
                <status>ok</status>
                <package-id>13</package-id>
            </result>
        </import-package>
    </aps>
</packet>

Such negative response is received if a requested file is not found:

<packet>
    <aps>
        <import-package>
            <result>
                <status>error</status>
                <errcode>1013</errcode>
                <errtext>File "/usr/local/psa/tmp/li_8FZruf" does not exist</errtext>
            </result>
        </import-package>
    </aps>
</packet>

Such negative responses are received in cases a file being imported is not a valid APS application package.

1) The archive being imported lacks APP-META.xml package metadata file.

<packet>
    <aps>
        <import-package>
            <result>
                <status>error</status>
                <errcode>1023</errcode>
                <errtext>Entry 'APP-META.xml' not found</errtext>
            </result>
        </import-package>
    </aps>
</packet>
  1. APP-META.xml is not validated against the XML schema.
<packet>
    <aps>
        <import-package>
            <result>
                <status>error</status>
                <errcode>1023</errcode>
                <errtext>Unable to acquire metadata description</errtext>
            </result>
        </import-package>
    </aps>
</packet>