'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 1:[1]

You just need to send the parameters (It's not necesary to define them in an object), so try with this json:

{
    "parameters":[ 

         "2016-12-22T00:00",
         "2016-12-29T00:00",
         138124,
         1
    ]
 }

References:

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ruber Cuellar Valenzuela
Solution 2 Chris Gallo