issue
I get 4005 (when I modify the structure) or 5001 (when I run according to documentation) when trying to add a work schedule via POST request.
details
The documentation seems a little light (didn’t include a few fields I thought would be necessary), and I’m getting an internal server error whenever I try to add a work schedule.
I performed a GET request on an existing work schedule I want to repeat. I am using the values from that get to populate my template POST request.
troubleshooting
- After my first attempts didn’t work, I added WorkItemTitleDisplayText and AssigneeUserKey. They are not added in the documentation, but perhaps they must be added/updated via PUT once the schedule creates.
- I noticed that the GET request returns a JSON element as a string. I de-escaped it to see if the API expected JSON instead of a string coming back, but I got a 4005 error.
- The offset integer for the variable portion was passed as a string in the GET request but as an integer in the text portion, so I tried it as an integer. No luck.
- I noticed the date for ending had a strange format from the GET request, so I tried “forever” and “Forever” to match the web app. Got a 4005 error.
- Adding a real date to the end date field resulted in the same 5001 error from before.
- I noticed that the work item key from the GET request was null. I don’t have a way to play around with that since there’s no other way to specify which work item gets the schedule, as far as I can tell. I thought it was odd.
I’m not sure what I’m missing
See here for code walls:
Here’s my body:
{
"CreatedFromWorkItemKey": "3PNmk5cmNv8",
"RecurrenceFrequency": "Year",
"CustomFrequencyMultiple": 1,
"ScheduleStartDate": "2023-01-01",
"AssigneeUserKey": "4vD6m5Q9MdyP",
"WorkItemTitleDisplayText": "{Previous Repeat Period Date (YYYY - YYYY)} Form 1120 Corporate Income Tax Return",
"ScheduleDueDateMethod": "Day of (2nd, 3rd, ...) month after start month",
"PreventStartEndOnWeekend": false,
"InitializeTasksBeforeStartDateUnits": "Months",
"InitializeTasksBeforeStartDateMultiple": 3,
"WorkItemTitleDefinition": " {\"Text\":null,\"Variable\":\"RepeatPeriod\",\"Offset\":\"-1\",\"Format\":\"YYYY - YYYY\"},{\"Text\":\" Form 1120 Corporate Income Tax Return\",\"Variable\":null,\"Offset\":0,\"Format\":null}]",
"CustomFrequencyUnits": "Months",
"ScheduleEndDate": "2027-01-01",
"ScheduleDueDateDays": 15,
"ScheduleDueDateMonthMultiple": 3,
"InitializeBeforeStartDateUnits": "Months",
"InitializeBeforeStartDateMultiple": 3
}
Here’s the response:
{
"error": {
"code": "5001",
"message": "Unexpected Internal Error. Please contact Karbon HQ Technical support with API Request Id of **masked**."
}
}
If I change ScheduleEndDate from "0001-01-01T00:00:00Z" to “Forever”, I get:
{
"error": {
"code": "4005",
"message": "Required payload data is missing: workSchedule"
}
}
Changing it to an actual date returns the 5001 error.
WorkItemTitleDefinition field passes a JSON element as a string when performing the GET request, so that’s my initial focus for troubleshooting. I de-escaped all the quotes to get it back to JSON and tried to submit but got the 4005 error.
{
"CreatedFromWorkItemKey": "3PNmk5cmNv8",
"RecurrenceFrequency": "Year",
"CustomFrequencyMultiple": 1,
"ScheduleStartDate": "2023-01-01",
"AssigneeUserKey": "4vD6m5Q9MdyP",
"WorkItemTitleDisplayText": "{Previous Repeat Period Date (YYYY - YYYY)} Form 1120 Corporate Income Tax Return",
"ScheduleDueDateMethod": "Day of (2nd, 3rd, ...) month after start month",
"PreventStartEndOnWeekend": false,
"InitializeTasksBeforeStartDateUnits": "Months",
"InitializeTasksBeforeStartDateMultiple": 3,
"WorkItemTitleDefinition": "
{
"Text":null,
"Variable":"RepeatPeriod",
"Offset":-1,
"Format":"YYYY - YYYY"},
{
"Text":" Form 1120 Corporate Income Tax Return",
"Variable":null,
"Offset":0,
"Format":null
}
],
"CustomFrequencyUnits": "Months",
"ScheduleEndDate": "0001-01-01T00:00:00Z",
"ScheduleDueDateDays": 15,
"ScheduleDueDateMonthMultiple": 3,
"InitializeBeforeStartDateUnits": "Months",
"InitializeBeforeStartDateMultiple": 3
}
I tried the “-1” offset in and out of quotes. Same 4005 error.
I tried running it without the assignee and description text fields. Same 4005 error.