# Create a schedule to execute Remote Restart or Shutdown on devices in groups Create the scheduler for the restart and shutdown action to perform in the devices or groups. ## Endpoint `POST /api/v1/mdm/actions/scheduled/{action_name}` ## Request URL `https://[{serverurl}](https://www.manageengine.com/mobile-device-management/help/api/cloud/oauth-authentication-endpoint-domain.html)/api/v1/mdm/actions/scheduled/{action_name}` ## Scope `MDMOnDemand.MDMDeviceMgmt.CREATE` ## Header `Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52` ## Request Parameters ### Request Headers - **Content-Type** `string` — **Mandatory** — `application/json` - **Accept** `string` — **Mandatory** — `application/json` ### Path Parameters - **action_name** `string` — **Mandatory** Name of the scheduled action. ### Request Body `application/json` - `JSON object` - **groups** `array` — **Mandatory** Array of group IDs with devices that need to be restarted or shutdown (required). - **time_zone** `string` — Optional Timezone for which the scheduled action is to be executed (required). - **schedule_params** `JSON object` — Optional Parameters for the schedule (required). - **reason_message** `string` — Optional Reason for scheduling the action, used for auditing purposes (required). - **execution_type** `integer` — Optional Type of execution: 1 = Once, 2 = Repeat (required). - **expiry** `long` — Optional Time in milliseconds at which the scheduled command expires (required). - **schedule_once_time** `long` — Optional Current time in milliseconds when action is scheduled to be executed once (required). - **action_name** `string` — Optional Name of the action: restart or shutdown. ## Sample Request ```curl curl --request POST \ --url https://appdomain/api/v1/mdm/actions/scheduled/{action_name} \ --header 'Accept: application/json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{"groups":["9007199254741037","9007199254741038","9007199254741039"]}' ``` ## Sample Request Body ### Create a daily restart schedule for 3 device groups ```json { "schedule_params": { "schedule_type": "Daily", "daily_time": "10/25/2018, 15:30", "daily_interval_type": "everyDay" }, "reason_message": "Maintenance", "action_name": "restart", "groups": [ "9007199254741037", "9007199254741038", "9007199254741039" ], "execution_type": 2, "expiry": 600000, "time_zone": "America/Los_Angeles", "schedule_once_time": 1627970696000 } ``` ### Create a weekly shutdown schedule on Mon/Wed/Fri ```json { "schedule_params": { "days_of_week": "1,3,5", "schedule_type": "Weekly", "weekly_time": "1800" }, "reason_message": "End of day shutdown", "action_name": "shutdown", "groups": [ "9007199254741052", "9007199254741053" ], "execution_type": 2, "expiry": 600000, "time_zone": "America/New_York", "schedule_once_time": 1627970696000 } ``` ## Possible Response Codes - **202** `HTTP code` ## Sample Response: HTTP 202 ```text 202 Accepted ``` ![ ](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.