Replace DomainMappings of an Environment. After the request is completed, all DomainMappings from the request exist in the environment, and no other DomainMapping exists there.
POST
/v1/accounts/{account}/apps/{app}/environments/{environment}/domainMappings:replace
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://js.wpengineapi.com/v1/accounts/example/apps/example/environments/example/domainMappings:replace"
payload := strings.NewReader("{ \"domainMappings\": [ { \"destinationDomainMapping\": \"example\", \"destinationDomainMappingState\": \"STATE_UNSPECIFIED\", \"domain\": \"example\", \"primary\": true, \"state\": \"STATE_UNSPECIFIED\" } ], \"validateOnly\": true }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <credentials>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://js.wpengineapi.com/v1/accounts/example/apps/example/environments/example/domainMappings:replace';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"domainMappings":[{"destinationDomainMapping":"example","destinationDomainMappingState":"STATE_UNSPECIFIED","domain":"example","primary":true,"state":"STATE_UNSPECIFIED"}],"validateOnly":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://js.wpengineapi.com/v1/accounts/example/apps/example/environments/example/domainMappings:replace \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "domainMappings": [ { "destinationDomainMapping": "example", "destinationDomainMappingState": "STATE_UNSPECIFIED", "domain": "example", "primary": true, "state": "STATE_UNSPECIFIED" } ], "validateOnly": true }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”account
required
string
Name of your WP Engine Headless Platform account
app
required
string
Name of your Headless Platform application
environment
required
string
ID of your environment
Request Body
Section titled “Request Body”Media typeapplication/json
Request to replace DomainMappings.
object
domainMappings
DomainMappings that should replace the current DomainMappings of the Environment
Array<object>
DomainMapping represents a domain associated with an environmentobject
destinationDomainMapping
Domain redirect associated with this DomainMapping in the format of
accounts/{account}/apps/{app}/environments/{environment}/domainMappings/{domain_mapping}
string
destinationDomainMappingState
Possible states of a DomainMapping
- STATE_UNSPECIFIED: Domain mapping state is unknown
- CREATING: Domain mapping is being created
- DELETING: Domain mapping is being deleted
- ACTIVE: Domain mapping is deployed. Does not necessarily mean that the domain is already directing to the environment, as Cloudflare status is currently not checked
- FAILED: Domain mapping creation has failed, or domain was created but is no longer active due to other error
string
domain
required
Domain name of the domain associated with the environment by this DomainMapping
Must be a valid domain name as defined in RFC-1123
string
name
Output only. Domain mapping name in the format of:
`accounts/{account}/apps/{app}/environments/{environment}/domainMappings/{domain_mapping}`
string
primary
Defines if domain mapping is primary
boolean
state
Possible states of a DomainMapping
- STATE_UNSPECIFIED: Domain mapping state is unknown
- CREATING: Domain mapping is being created
- DELETING: Domain mapping is being deleted
- ACTIVE: Domain mapping is deployed. Does not necessarily mean that the domain is already directing to the environment, as Cloudflare status is currently not checked
- FAILED: Domain mapping creation has failed, or domain was created but is no longer active due to other error
string
txtRecordVerifiedTime
Domain mapping txt record verified at
string format: date-time
txtVerificationName
Domain mapping txt verification record name
string
txtVerificationValue
Domain mapping txt verification record value
string
validateOnly
If set, domain availability is checked, but current DomainMappings are not replaced
boolean
Responses
Section titled “Responses”A successful response.
Media typeapplication/json
This resource represents a long-running operation that is the result of a network API call
object
done
Information if the operation is done or still in progress
boolean
metadata
Long running operation metadata
object
@type
A URL/resource name that uniquely identifies the type of the serialized protocol buffer message
string
build
Build name in the format of: accounts/{account}/apps/{app}/environments/{environment}/builds/{build}
string
envID
Environment ID
string
name
Operation name in the format of: accounts/{account}/apps/{app}/environments/{environment}/operations/{operation}
string
Examplegenerated
{ "done": true, "metadata": { "@type": "example", "build": "example", "envID": "example" }, "name": "example"}