Installing a Node.js or Python application using the API
Prerequisites
To install a Node.js or Python 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 Node.js/Python application (see next section)
Determine the app and app version ID
Before installing a Node.js or Python application, you will need to determine the application ID and version ID of the generic custom Node.js (or Python, respectively) application.
For this, call the GET/
endpoint, and find the "Node.js" or "Python" application. These should have the following stable IDs:
- Node.js:
3e7f920b-a711-4d2f-9871-661e1b41a2f0
- Python:
be57d166-dae9-4480-bae2-da3f3c6f0a2e
Use the respective ID, depending on whether you want to install a Node.js or Python application. You can then use that ID to retrieve the recommended version to install for this app, by calling the GET/
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/
endpoint. The relevant fields are the following:
appVersionId
needs to be the app version ID that you retrieved in the previous step.userInputs
needs to be an array of objects, each containing aname
andvalue
property. The allowed values forname
are contained in theuserInputs
array of the app version object. In the case of Node.js, the only allowed value isentrypoint
, which is the command that will be run to start your application.updatePolicy
needs to be set tonone
, 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": "97fb8684-3fe3-4720-86fb-fb0524ae88d1",
"description": "Your Node.js app",
"updatePolicy": "none",
"userInputs": [
{
"name": "entrypoint",
"value": "yarn start"
}
]
}
/v2/projects/{projectId}/app-installations/
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/
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.