DX Infrastructure Manager

Expand all | Collapse all

Maintenance mode API

  • 1.  Maintenance mode API

    Posted 12-28-2017 06:11 AM

    Hi,

     

    Am new to REST API's and am trying to write maintenance mode API for adding a list of robots to a maintenance schedule.

    first i try to create a schedule and next, i will add robots to that schedule. I  followed  below link to create a schedule for maintenance and am getting " Bad Request " error.

     

    Maintenance Calls - CA Unified Infrastructure Management Probes - CA Technologies Documentation 

     

    Am i missing something ? please help me to understand and kindly let me know if there are any other tech documents available to understand it.



  • 2.  Re: Maintenance mode API

    Posted 12-28-2017 08:05 AM

    We would need more information

    -UMP version running?

    http://ump_ip:port/html/version.txt

    -rest version running?

    http://<your_UMP_address>:<port>/rest/version-info

     

    Exact call you are making

    the body information for the json or xml you are using.



  • 3.  Re: Maintenance mode API

    Posted 12-28-2017 08:26 AM

    UMP 8.47

     

    Rest version

    <version_info>
    <value>
    Nimsoft RESTful web services interface: version: 8.4.7-E, build_number: 144840
    </value>
    </version_info>

    Post Method:

    http://ump-address/rest/maintenance_mode/domain/HUB/Robot/add_schedule

    Content-Type: application/json

    Accept: application/json
    {
    "name": "Test Sched A",
    "description": "Test schedule for Maintenance Mode REST API.",
    "start_date_time": {
    "month": "12",
    "day": "28",
    "year": "2017",
    "timestamp": {
    "hours": "05",
    "minutes": "30",
    "seconds": "22"
    }
    },
    "end_time": {
    "type": "duration",
    "end_date_time": {
    "month": "12",
    "day": "28",
    "year": "2017",
    "timestamp": {
    "hours": "05",
    "minutes": "40",
    "seconds": "01"
    }
    },
    "duration": {
    "hours": "24",
    "minutes": "",
    "seconds": ""
    }
    },
    "account_id": "",
    "recurrence_pattern": "",
    "recurrence_period": "Monthly",
    "recurrence_days_of_the_week": "",
    "recurrence_day_of_the_month": "",
    "recurrence_instance": "",
    "recurrence_end_date_time": {
    "month": "",
    "day": "",
    "year": "",
    "timestamp": {
    "hours": "",
    "minutes": "",
    "seconds": ""
    }
    },
    "timezone": "Canada/Pacific"
    }

     

    Am not giving any recurrence values.



  • 4.  Re: Maintenance mode API

    Posted 12-28-2017 02:40 PM

    your is failing because you have a recurring period setup.

    remove the "monthly" in the recurring section:

    should look like

    {
    "name": "Test Sched B",
    "description": "Test schedule for Maintenance Mode REST API-B.",
    "start_date_time": {
    "month": "1",
    "day": "2",
    "year": "2018",
    "timestamp": {
    "hours": "05",
    "minutes": "30",
    "seconds": "22"
    }
    },
    "end_time": {
    "type": "duration",
    "end_date_time": {
    "month": "1",
    "day": "3",
    "year": "2018",
    "timestamp": {
    "hours": "05",
    "minutes": "40",
    "seconds": "01"
    }
    },
    "duration": {
    "hours": "24",
    "minutes": "",
    "seconds": ""
    }
    },
    "account_id": "",
    "recurrence_pattern": "",
    "recurrence_period": "",
    "recurrence_days_of_the_week": "",
    "recurrence_day_of_the_month": "",
    "recurrence_instance": "",
    "recurrence_end_date_time": {
    "month": "",
    "day": "",
    "year": "",
    "timestamp": {
    "hours": "",
    "minutes": "",
    "seconds": ""
    }
    },
    "timezone": "Australia/Lindeman"
    }



  • 5.  Re: Maintenance mode API

    Posted 12-29-2017 04:57 AM

    Hi,

     

    Again am getting same error.

     

    http://UMP-Address/rest/maintenance_mode/Domain/HUB/Robot/add_schedule  HTTP/1.1

     

    Request Method: POST
    Response Time: 0.267 seconds
    Response Status: 404 - Not Found

     

    Content-Type: application/json
    Accept: application/json
    {
    "name": "Test Sched B",
    "description": "Test schedule for Maintenance Mode REST API-B.",
    "start_date_time": {
    "month": "12",
    "day": "29",
    "year": "2017",
    "timestamp": {
    "hours": "01",
    "minutes": "50",
    "seconds": "01"
    }
    },
    "end_time": {
    "type": "duration",
    "end_date_time": {
    "month": "12",
    "day": "29",
    "year": "2017",
    "timestamp": {
    "hours": "02",
    "minutes": "05",
    "seconds": "01"
    }
    },
    "duration": {
    "hours": "24",
    "minutes": "",
    "seconds": ""
    }
    },
    "account_id": "",
    "recurrence_pattern": "",
    "recurrence_period": "",
    "recurrence_days_of_the_week": "",
    "recurrence_day_of_the_month": "",
    "recurrence_instance": "",
    "recurrence_end_date_time": {
    "month": "",
    "day": "",
    "year": "",
    "timestamp": {
    "hours": "",
    "minutes": "",
    "seconds": ""
    }
    },
    "timezone": "Canada/Pacific"
    }



  • 6.  Re: Maintenance mode API

    Posted 12-29-2017 07:42 AM

    Hi

    Thats the log from my script

    24.12.2017 - 00:04:26: DEBUG - REST - SEND - URL: wvasp-uim1.Foooo.com/rest/maintenance_mode/FoooProd/wvasp-uim1-hub/wvasp-uim1/add_schedule
    24.12.2017 - 00:04:26: DEBUG - REST - SEND - JSON: {"start_date_time": {"timestamp": {"hours": "15", "seconds": "00", "minutes": "30"}, "year": "2017", "day": "24", "month": "12"}, "name": "Patch-SpaceWalk-1530-UMTSW-20171224-1530-66", "description": "Via UIMMaintenanceTool automatisiert gesetztes Wartungsfenster", "end_time": {"duration": {"hours": "1", "seconds": "", "minutes": "6"}, "type": "duration", "end_date_time": {"timestamp": {"hours": "", "seconds": "", "minutes": ""}, "year": "", "day": "", "month": ""}}, "timezone": "Europe/Berlin", "account_id": "17"}

     

    Thats working, well its a 8.5.1. hope it helps

     

    cheers

    Matthias



  • 7.  Re: Maintenance mode API

    Posted 12-29-2017 07:50 AM

    HA! 

    Do it on the main-hub, Maintenance-Stuff doesnt work against UMP-REST

    Cheers

    Matthias



  • 8.  Re: Maintenance mode API

    Posted 12-29-2017 08:49 AM

    Hi ,

     

    my verison is 8.4.7 and i understand we need to provide main hub address instead of UMP address.

     

    In my setup both UMP and Main hub are in same server. Could you help me how to perform it,



  • 9.  Re: Maintenance mode API

    Posted 12-29-2017 08:53 AM

    I will test in my 8.4.7 lab later today and make sure this works on that version.

    My testing was done on 8.51

    one thing you can try is to make sure your end date is greater than the start time PLUS the duration.

    currently your end time is less than that as your are doing 24 hours for your duration



  • 10.  Re: Maintenance mode API

    Posted 12-29-2017 09:32 AM

    rkalidh87

     

    If you are getting a 404 error then the http path in my experience is incorrect. One of the things I found out the hard way was that the hub, robot and domain names are all case sensitive. Essentially the API is using this information to find the maintenance_mode probe address to initiate the changes. I would ensure the http path is correct before worrying about the data being posted. Everything after the /rest/maintenance_mode/ should be an exact match including case as shown in Infrastructure Manager or Admin Console.

     

    Not applicable in this case but something else to watch out for is UIM will NOT accept a schedule that starts in the past. To deal with this we pad our start times by some seconds to ensure that it is not rejected.



  • 11.  Re: Maintenance mode API

    Posted 12-29-2017 11:01 AM

    Hi,

     

    Am able to make other API calls via the same API structure, but only maintenance mode schedule is problematic. 

     

    I have changed the time duration as mentioned above, but still same error.



  • 12.  Re: Maintenance mode API

    Posted 12-29-2017 03:14 PM

    I just tested in my UIM 8.47 lab the following and this worked

    {
    "name": "Test Sched B",
    "description": "Test schedule for Maintenance Mode REST API-B.",
    "start_date_time": {
    "month": "12",
    "day": "29",
    "year": "2017",
    "timestamp": {
    "hours": "15",
    "minutes": "50",
    "seconds": "01"
    }
    },
    "end_time": {
    "type": "duration",
    "end_date_time": {
    "month": "12",
    "day": "30",
    "year": "2017",
    "timestamp": {
    "hours": "15",
    "minutes": "55",
    "seconds": "01"
    }
    },
    "duration": {
    "hours": "24",
    "minutes": "",
    "seconds": ""
    }
    },
    "account_id": "",
    "recurrence_pattern": "",
    "recurrence_period": "",
    "recurrence_days_of_the_week": "",
    "recurrence_day_of_the_month": "",
    "recurrence_instance": "",
    "recurrence_end_date_time": {
    "month": "",
    "day": "",
    "year": "",
    "timestamp": {
    "hours": "",
    "minutes": "",
    "seconds": ""
    }
    },
    "timezone": "Canada/Pacific"
    }

     

    I would suggest you open a Support case as I think we webex migbht be needed



  • 13.  Re: Maintenance mode API

    Posted 01-02-2018 12:31 PM

    Hi,

     

    Thanks for your effort. I have opened a case with support team. Need one more clarity.

     

    is there a way available to integrate Servicenow istanbul  version with nimsoft 8.4.7



  • 14.  Re: Maintenance mode API

    Posted 01-06-2018 10:20 AM

    Hi Gene,

     

    It is working now. Issue is with client which am using. (YARC).