Skip to main content

Managing automatic app updates using the API

mStudio can keep managed apps like WordPress, TYPO3 or Nextcloud up to date automatically. This guide explains how to activate automatic updates via the API, for example for many app installations at once, and how to find out whether an automatic update has failed.

Prerequisites​

To manage automatic updates, you will need to have the following:

  • The ID of an existing app installation, or the project ID if you want to work on all app installations of a project (how to create a project‍)
  • An app whose current version supports automatic updates (see below‍)

How automatic updates work​

  • Update range: Which versions an app installation is automatically updated to is defined by mittwald per app version. The updateConstraint property of the current app version (see GET/v2/apps/{appId}/versions/{appVersionId}‍) contains a SemVer constraint that a newer version must satisfy. Depending on the software, this covers every new version (WordPress), minor and patch updates (Nextcloud, Matomo) or patch updates only (TYPO3, Contao, Drupal, Joomla!, Shopware 6). You cannot change this range yourself.
  • Timing: Automatic updates run directly after the daily system backup of the project. New versions are rolled out gradually, so not every app installation is updated on the day a version is released.
  • Failures: If an automatic update fails, the app installation is reset to its previous version, automatic updates are stopped for this app installation, and the project's administrators and developers are notified by email.

Plugins, themes and extensions are not updated automatically.

Find app installations that support automatic updates​

Both GET/v2/projects/{projectId}/app-installations‍ (for a single project) and GET/v2/app-installations‍ (across all projects you can access) accept two query parameters for this:

  • autoUpdatesSupported=true only returns app installations whose current app version supports automatic updates.
  • autoUpdatesActivated=false only returns app installations whose automatic updates are not activated.

Combine both parameters to get all app installations whose automatic updates can be activated:

GET /v2/projects/PROJECT_ID/app-installations?autoUpdatesSupported=true&autoUpdatesActivated=false

Activate or deactivate automatic updates​

To activate automatic updates for an app installation, use the PATCH/v2/app-installations/{appInstallationId}‍ endpoint and set the autoUpdatesActivated property to true:

PATCH /v2/app-installations/APP_INSTALLATION_ID HTTP/1.1
Host: api.mittwald.de
Content-Type: application/json

{
"autoUpdatesActivated": true
}

To deactivate automatic updates, set autoUpdatesActivated to false. To activate automatic updates for many app installations at once, call this endpoint for each app installation returned by the query above‍. The list endpoints are paginated: use the limit and skip (or page) query parameters and the X-Pagination-TotalCount response header to fetch all pages, otherwise you will only activate automatic updates for the first page of results.

Detect failed automatic updates​

The app installation returned by GET/v2/app-installations/{appInstallationId}‍ contains the following properties:

  • autoUpdatesActivated indicates whether automatic updates are currently activated.
  • autoUpdatesStoppedAfterFailure is true if automatic updates were stopped because an automatic update failed. It is reset when you activate automatic updates again and is not set when automatic updates are deactivated deliberately.
  • lastAutoUpdateFailedAt contains the time of the last failed automatic update. The value is kept when automatic updates are activated again, so use autoUpdatesStoppedAfterFailure to check whether automatic updates are currently stopped.
  • lastError contains the last error that occurred during an update and is reset on success.

After checking the app installation, activate automatic updates again as described above‍.

On this page