create app
Purpose
This functionality allows you to create a new WP Engine Headless Application, without using Atlas CLI
.
Prerequsites
In order to allow this functionality you must first create API access by generating auth credentials in Portal’s lefthand menu - Users > API access (tab) > Generate credentials
. The screenshots below walk you through what you will see. Next, copy the API credentials & ensure you have your target repo zipfile & CURL installed locally. Finally, you will need the target Portal Account Name, along with an existing App Name & Env Id (UUID).
Running Create app command in CURL
Run the following commands replacing the path capitals and shellVariables
with your own values.
The {PUT_YOUR_ENV_NAME_HERE}
corresponds to the WP Engine User Portal environments where you have your WP site. So if your domain is myapp.wpengine.com
, your environment would be myapp
.
The available regions for {PUT_REGION_HERE}
variable are US-C
, EU-W
, AUS-SE
and UK
.
- Create an Atlas Application:
curl -X POST -H 'Content-Type: application/json' -u "PUT_USER_ID_HERE:PUT_PASSWORD_HERE" \
'https://js.wpengineapi.com/v1/accounts/{PUT_ACCOUNT_NAME_HERE}/apps?appId={PUT_YOUR_NEW_APP_NAME_HERE}' \
--data-raw '{"region":"regions/{PUT_REGION_HERE}","uploadable":{}}'
- Connect an app with the environment corresponding to the WP Engine User Portal environments where you have your WP site.
curl -X POST -H 'Content-Type: application/json' -u "PUT_USER_ID_HERE:PUT_PASSWORD_HERE" \
'https://js.wpengineapi.com/v1/accounts/{PUT_ACCOUNT_NAME_HERE}/apps/{PUT_YOUR_NEW_APP_NAME_HERE}/environments' \
--data-raw '{"displayName":"{PUT_YOUR_ENV_NAME_HERE}","branch":"uploadable","wpEnvironment":"{PUT_YOUR_WORDPRESS_INSTALL_NAME_HERE}","shellVariables":[{"key":"foo","value":"bar"}]}'
Example long-running operation response, that starts application deployment to the environment.
{
"name": "accounts/{ACCOUNT_NAME}/apps/{YOUR_NEW_APP_NAME}/environments/{ENV_UUID}/operations/no_build",
"metadata": {
"@type": "type.googleapis.com/wpengine.js.apps.v1.UpdateEnvironmentMetadata",
"build": "accounts/{ACCOUNT_NAME}/apps/{YOUR_NEW_APP_NAME}/environments/{ENV_UUID}/builds/no_build",
"deployment": ""
},
"done": false
}
Notes:
In case of Create an Atlas Application CURL HTTP Response will give 200
status, but will not return a response body, if successful. If you would like more detail add the -i
(include the HTTP response headers in the output) or -v
(makes curl verbose during the operation) flag to the above CURL command. You can also check Portal to see the Atlas Environment buildng state.