apiibm-cloud-infrastructure

How to Use getMaintenanceWindows method by using a SoftLayer REST API


please tell me how to get available maintenance windows by using a SoftLayer REST API. I tried it in the following way, but it did not work.

curl -K support -d @Maintence.json -X POST https://api.softlayer.com/rest/v3/SoftLayer_Provisioning_Maintenance_Window/getMaintenceWindows

When executing the command, the following error message is displayed:

{"error":"End date must be a later date than begin date.","code":"SoftLayer_Exception"}

The contents of the JSON file are described below:

 {
    "parameters":[ 
    { 
         "beginDate": "2016-12-22T00:00",
          "endDate": "2016-12-29T00:00",
         "locationId": 138124,
         "slotsNeeded" : 1
    }]
 }

Solution

  • The proper API to use here is SoftLayer_Provisioning_Maintenance_Window::getMaintenanceWindows() as opposed to the misspelled getMaintenceWindows

    The API payload is still the same.

    curl -K support -d @Maintence.json -X POST https://api.softlayer.com/rest/v3/SoftLayer_Provisioning_Maintenance_Window/getMaintenanceWindows
    
    {
        "parameters":[ 
    
             "2016-12-22T00:00",
             "2016-12-29T00:00",
             138124,
             1
        ]
     }
    

    When making API calls to the softlayer API, the parameters are not named, just listed in order that matches the documentation.