Skip to content
Atlas Platform
GitHubDiscordYouTube

Create Atlas app through direct upload

Purpose

This feature enables you to create a new WP Engine Headless application through a direct upload method. It targets Atlas users utilizing version control hosting systems not directly supported by WP Engine by default, such as Azure Repositories or self-hosted versions of GitLab and Bitbucket.

Prerequsites

Obtain credentials to use WP Engine API through the process described in the Atlas API authentication document.

Running the create app command through cURL

First, create an Atlas application using the following endpoint:

curl -X POST -H 'Content-Type: application/json' -u "API_USER_ID:API_PASSWORD" \
'https://js.wpengineapi.com/v1/accounts/{ACCOUNT_NAME}/apps?appId={NEW_APP_NAME}' \
--data-raw '{"region":"regions/{REGION}","uploadable":{}}'
  • API_USER_ID - your API username
  • API_PASSWORD - your API password
  • ACCOUNT_NAME - your WP Engine account name (e.g. myaccount)
  • NEW_APP_NAME - name of the application you want to create (e.g. my-app)
  • REGION - region where the environments of your application should be hosted (available values: US-C - US Central, AUS-SE - Australia Southeast, UK - United Kingdom, EU-W - Europe West)

Then, create a new Atlas environment, replacing the path capitals and shellVariables with your own values.

curl -X POST -H 'Content-Type: application/json' -u "API_USER_ID:API_PASSWORD" \
'https://js.wpengineapi.com/v1/accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments' \
--data-raw '{"displayName":"{NEW_ENV_NAME}","branch":"uploadable","wpEnvironment":"{WORDPRESS_INSTALL_NAME}","shellVariables":[{"key":"foo","value":"bar"}]}'
  • API_USER_ID - your API username
  • API_PASSWORD - your API password
  • ACCOUNT_NAME - your WP Engine account name (e.g. myaccount)
  • APP_NAME - name of the application you have just created (e.g. my-app)
  • NEW_ENV_NAME - name of the environment you want to create (e.g. production)
  • WORDPRESS_INSTALL_NAME - name of the WordPress install you want to connect your Atlas environment to

shellVariables field is intended for your environment variables that can be added to your application in the form of key-value pairs.

Note: the value of branch must be equal to uploadable.

You’ll receive the following response from the API:

   {
   "name": "accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments/{ENVIRONMENT_ID}/operations/no_build",
   "metadata": {
       "@type": "type.googleapis.com/wpengine.js.apps.v1.UpdateEnvironmentMetadata",
       "build": "accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments/{ENVIRONMENT_ID}/builds/no_build",
       "deployment": ""
   },
   "done": false
}

Use the information returned in the response to upload .zip file containing your application code:

    curl -X POST -H 'Content-Type: multipart/form-data' -u "API_USER_ID:API_PASSWORD" \
    -F repository=@PATH_TO_FILE \
    https://js.wpengineapi.com/v1/accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments/{ENVIRONMENT_ID}:upload
  • API_USER_ID - your API username
  • API_PASSWORD - your API password
  • ACCOUNT_NAME - your WP Engine account name (e.g. myaccount)
  • APP_NAME - name of the application you have just created (e.g. my-app)
  • ENVIRONMENT_ID - ID of the Atlas environment you have just created

Once the request is made successfully, the environment is being deployed. A long-running operation is returned in response:

{
    "name": "accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments/{ENVIRONMENT_ID}/operations/no_build",
    "metadata": {
        "@type": "type.googleapis.com/wpengine.js.apps.v1.UpdateEnvironmentMetadata",
        "build": "accounts/{ACCOUNT_NAME}/apps/{APP_NAME}/environments/{ENVIRONMENT_ID}/builds/no_build",
        "deployment": ""
    },
    "done": false
}

Notes:

When creating an Atlas application via cURL, a successful operation will yield a 200 status code without a response body.

For further details, you can enhance the cURL command by adding the -i flag to include HTTP response headers in the output - or the -v flag for verbose mode.

Additionally, you can monitor the building state of the Atlas environment through the User Portal.