Update workspace autostart schedule by ID
PUT
CoderSessionTokenheader
Coder-Session-Token<token>workspace*stringWorkspace ID
Format
uuidSchedule update request
application/json- body
schedule?stringSchedule is expected to be of the form CRON_TZ=<IANA Timezone> <min> <hour> * * <dow>
Example: CRON_TZ=US/Central 30 9 * * 1-5 represents 0930 in the timezone US/Central
on weekdays (Mon-Fri). CRON_TZ defaults to UTC if not present.
No Content
The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X PUT \ "$CODER_URL/api/v2/workspaces/{workspace}/autostart" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "schedule": "string"}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/workspaces/{workspace}/autostart`;const response = await fetch(url, { method: "PUT", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ schedule: "string", }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/workspaces/{workspace}/autostart"token = os.environ["CODER_SESSION_TOKEN"]response = requests.put( url, headers={ "Coder-Session-Token": token, }, json={ "schedule": "string", },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "schedule": "string"}`) url := os.Getenv("CODER_URL") + "/api/v2/workspaces/{workspace}/autostart" token := os.Getenv("CODER_SESSION_TOKEN") req, err := http.NewRequest(http.MethodPut, url, body) if err != nil { panic(err) } req.Header.Set("Coder-Session-Token", token) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response204
Empty