Update a report schedule
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.wpengineapi.com/v1/site_reports/schedules/123e4567-e89b-12d3-a456-426614174000"
payload := strings.NewReader("{ \"title\": \"Monthly Site Performance Report\", \"next_scheduled_date\": \"2025-02-01T00:00:00.000Z\", \"template_uuid\": \"123e4567-e89b-12d3-a456-426614174000\", \"frequency\": { \"value\": 7, \"unit\": \"DAYS\" }, \"recipients\": [ { \"name\": \"Jane Doe\", \"email\": \"jane@example.com\" } ], \"sections\": [ { \"name\": \"cover\" } ] }")
req, _ := http.NewRequest("PATCH", 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://api.wpengineapi.com/v1/site_reports/schedules/123e4567-e89b-12d3-a456-426614174000';const options = { method: 'PATCH', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"title":"Monthly Site Performance Report","next_scheduled_date":"2025-02-01T00:00:00.000Z","template_uuid":"123e4567-e89b-12d3-a456-426614174000","frequency":{"value":7,"unit":"DAYS"},"recipients":[{"name":"Jane Doe","email":"jane@example.com"}],"sections":[{"name":"cover"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.wpengineapi.com/v1/site_reports/schedules/123e4567-e89b-12d3-a456-426614174000 \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "title": "Monthly Site Performance Report", "next_scheduled_date": "2025-02-01T00:00:00.000Z", "template_uuid": "123e4567-e89b-12d3-a456-426614174000", "frequency": { "value": 7, "unit": "DAYS" }, "recipients": [ { "name": "Jane Doe", "email": "jane@example.com" } ], "sections": [ { "name": "cover" } ] }'Updates an existing report schedule.
Reports run monthly, weekly or every two weeks, based on the schedule’s
frequency:
- Monthly: set
unittoMONTHLYandvalueto the day of the month (1-31). For example, 15 runs the report on the 15th of every month. - Weekly or every two weeks: set
unittoDAYSandvalueto 7 or 14. The day of the week is determined bynext_scheduled_date. For example, if it’s a Tuesday andvalueis 7, the report runs every Tuesday.
Limitations & Warnings
- If a monthly schedule is set to the 29th, 30th or 31st and that date doesn’t exist in a given month, the report runs on the last day of that month.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”ID of the schedule to update
Example
123e4567-e89b-12d3-a456-426614174000Request Bodyrequired
Section titled “Request Bodyrequired”object
Title for the scheduled report
Example
Monthly Site Performance ReportISO 8601 datetime for the next report generation
Example
2025-02-01T00:00:00.000ZUUID of the report template to use
Example
123e4567-e89b-12d3-a456-426614174000Report generation frequency. For DAYS, set value to 7 (weekly) or 14 (biweekly). For MONTHLY, set value to the day of the month (1-31).
object
Frequency value. For DAYS, value is 7 or 14. For MONTHLY, value is the day of the month (1-31).
Example
7Frequency unit. ‘DAYS’ for weekly or biweekly reports, ‘MONTHLY’ for monthly reports.
Example
DAYSList of recipients for the report
object
Example
Jane DoeExample
jane@example.comSections to include in the report. Valid section names depend on the template
(e.g. cover, overview, usage, themes). Use GET /site_reports/templates
to discover available sections for a given template.
object
Example
coverResponses
Section titled “Responses”Returns a confirmation message.
object
Example
{ "message": "Schedule updated successfully"}Bad Request
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
An array of error objects describing specific errors that arose when servicing the request
object
The name of the resource that was being processed when the error occurred
(Optional) The specific field associated with the error
(Optional) A type associated with the error. invalid_value, access_error, value_unavailable
(Optional) A machine code relating to the error that occurred with the field and resource
(Optional) A human-readable message relating to the error that occurred with the field and resource
Example
{ "message": "Invalid request.", "errors": [ { "resource": "Resource", "field": "field_name", "type": "invalid_value", "code": "invalid", "message": "The value is invalid." } ]}Authentication Error
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "Bad Credentials"}Not authorized
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "You don't have permission to perform that action"}Not found
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "Not Found"}Too many requests
Internal Server Error
object
A message regarding the error that occurred on the server
Example
{ "message": "An unexpected error occurred, please try again in a few minutes"}An invalid response was received from an upstream server
Service unavailable