Direct upload to Headless Platform - upload .zip file with new version of your application code
POST
/fu/v1/accounts/{account}/apps/{app}/environments/{environment}:upload
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://js.wpengineapi.com/fu/v1/accounts/example/apps/example/environments/example:upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"repository\"; filename=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <credentials>") req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
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/fu/v1/accounts/example/apps/example/environments/example:upload';const form = new FormData();form.append('repository', 'file');
const options = {method: 'POST', headers: {Authorization: 'Basic <credentials>'}};
options.body = form;
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/fu/v1/accounts/example/apps/example/environments/example:upload \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: multipart/form-data' \ --form repository=@fileAuthorizations
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
FormData Parameters
Section titled “FormData Parameters ” repository
required
file
.zip file with your application code
Responses
Section titled “ Responses ”A successful response.
Media type application/json
object
Example generated
{}