Zum Hauptinhalt springen

Installing a PHP application using the API

Prerequisites

To install a PHP application, you will need to have the following:

  • The project ID of an existing project (how to create a project)
  • The application and version ID of the generic custom PHP application (see next section)

Determine the app and app version ID

Before installing a PHP application, you will need to determine the application ID and version ID of the generic custom PHP application.

For this, call the GET/v2/apps/ endpoint, and find the "PHP" application. It should have a stable ID of 34220303-cb87-4592-8a95-2eb20a97b2ac. You can then use that ID to retrieve the recommended version to install for this app, by calling the GET/v2/apps/{appId}/versions/ endpoint. You can filter the returned versions by the recommended property.

Please note that the actual version is rather inconsequential, as it refers only to the starter template used to create the application. The actual version of the application will be determined by your own code.

Install the application

To deploy your application, you will need to call the POST/v2/projects/{projectId}/app-installations/ endpoint. The relevant fields are the following:

  • appVersionId needs to be the app version ID that you retrieved in the previous step.
  • updatePolicy needs to be set to none, as you will typically want to update your application by yourself.

The complete HTTP request should look like this:

POST /v2/projects/{projectId}/app-installations HTTP/1.1
Host: api.mittwald.de
Content-Type: application/json

{
"appVersionId": "ff45ad04-8589-46d7-a645-0566be3eaeec",
"description": "Your PHP app",
"updatePolicy": "none"
}

The response will contain the installation ID, that you can subsequently use to access your application.

To observe the installation status, you can call the GET/v2/app-installations/{appInstallationId}/ endpoint. Pay special attention to the installationPath field; this will contain the directory in your project file system that you should deploy your application to.