I would like to create a maintenance schedule with the UIMAPI Swagger interface.
Release : 20.3+
Component: maintenance_mode
XML payload:
<?xml version="1.0" encoding="UTF-8"?>
<MaintenanceSchedule>
<account_id>-1</account_id>
<description>test</description>
<end_time>
<duration>
<hours>20</hours>
<minutes>00</minutes>
<seconds>00</seconds>
</duration>
<type>duration</type>
</end_time>
<name>My_Schedule</name>
<start_date_time>
<day>27</day>
<month>02</month>
<timestamp>
<hours>08</hours>
<minutes>45</minutes>
<seconds>00</seconds>
</timestamp>
<year>2023</year>
</start_date_time>
<timezone>PST</timezone>
</MaintenanceSchedule>
Curl command from my XML above:
curl -X POST "http://<uimapi system>:80/uimapi/maintenance_mode/<my_system>_domain/<my_system>_hub/<my_system>/add_schedule" -H "accept: application/xml" -H "Content-Type: application/xml" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><MaintenanceSchedule> <account_id>-1</account_id> <description>test</description> <end_time> <duration> <hours>20</hours> <minutes>00</minutes> <seconds>00</seconds> </duration> <type>duration</type> </end_time> <name>My_Schedule</name> <start_date_time> <day>27</day> <month>02</month> <timestamp> <hours>08</hours> <minutes>45</minutes> <seconds>00</seconds> </timestamp> <year>2023</year> </start_date_time> <timezone>PST</timezone></MaintenanceSchedule>"
You will need the schedule ID to be used in the curl command.
Curl command:
curl -X GET "http://<uimapi system>:80/uimapi/maintenance_mode/<my_system>_domain/<my_system>_hub/<my_system>/get_all_maintenance_schedules" -H "accept: application/xml"
http://<uimapi system>:80/uimapi/devices
The number 1 in the curl command below represents the schedule ID.
JSON payload (where the number represents the cs_id of the system to be added to the schedule):
{
"cs": [
9
]
}
Curl command for JSON payload above:
curl -X POST "http://<uimapi system>:80/uimapi/maintenance_mode/<my_system>_domain/<my_system>_hub/<my_system>/add_computer_systems_to_schedule/1" -H "accept: application/xml" -H "Content-Type: application/json" -d "{\"cs\":[9]}"
XML payload (where the number represents the cs_id of the system to be added to the schedule):
<?xml version="1.0" encoding="UTF-8"?>
<MaintenanceSchedule>
<cs>8</cs>
</MaintenanceSchedule>
Curl command for XML payload above:
curl -X POST "http://<uimapi system>:80/uimapi/maintenance_mode/<my_system>_domain/<my_system>_hub/<my_system>/add_computer_systems_to_schedule/1" -H "accept: application/xml" -H "Content-Type: application/xml" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><MaintenanceSchedule><cs>8</cs></MaintenanceSchedule>"