Skip to main content

Hello,


I am working on creating Maintenance Windows through the PagerDuty API. It seems very straight forward but I am not getting past this error:


"error": {
"message": "Invalid Input Provided",
"code": 2001,
"errors": [
"Start time cannot be empty."
]
}

}


My request body looks like this, and is exactly formatted like in the API documentation. I’ve double checked the time format, still no success. I guess it’s a super small/simple detail that I am overseeing…


{

“maintenance_window”: {

“type”: “maintenance_window”,

“start_time”: “2023-02-17T20:00:00+01:00”,

“end_time”: “2023-02-17T22:00:00+01:00”,

“description”: “Test Maintenance Window”,

“services”: n

{

“id”:“XXXXXXX”,

“type”:“service_reference”

}

]

}

}


Any help is greatly appreciated =)


Thanks and regards

Daniel

Hi Daniel. I copied your code into a bash script and it worked for me, so a couple of things I’d look at.


Make sure your editor isn’t using weird characters, quotes especially. Insidious and annoying.


Also make sure the API key you are using has permission to make changes to the service. That should give you a different error, but worth checking.


I dumped my script here, if that’s helpful https://github.com/lnxchk/pdgarage-samples/blob/main/create_mw.sh


Hi Mandi,


thanks for the quick response!

You’re right, it works elsewhere.


I got the error in postman (opened/imported the API via the PagerDuty Developer page).

Tried an alternative and it just worked with the exact same body…


Don’t have a solution for Postman yet but ultimately I was able to implement it with another method.


Thanks and regards

Daniel


Reply