Solved

Creating schedule with V3 api /fmerest/v3/schedules always creates a unhandled exception


When I use Python to try and post a schedule to FME Server using the v3 api, it always creates a Unhandled Exception on the server-side. I can view the exception in the Catalina log. I'm unsure why, but it thinks the payload isn't JSON even though it is. Has anyone been able to successfully post a schedule to the schedule endpoint using Python or other language and can post an example? I must be doing something wrong, but cannot tell.

 

The JSON is:

params = {"begin":"2022-08-08T01:00:00", "name":"test", "description":"test", "skipUntilJobComplete":True, "enabled": True, "interval":2, "recurrence":"interval", "repository":"TEST", "workspace":"test.fmw", "unit":"MINUTE", "category":"Utilities"}

 

which is posted like this in Python:

serviceresponse = requests.post(jobSubmitUrl,json=params,headers=jobHeader)

 

The error is: b'{"message":"An unhandled exception has occurred due to some unexpectedly omitted information, consult the web service logs for further details"}' In the Catalina log, I find it says that it can't parse the JSON.

 

The header works fine and is used elsewhere with no issue, so I'm certain that isn't the problem.

 

Any ideas would be appreciated.

icon

Best answer by david.jones 9 August 2022, 23:17

View original

2 replies

Badge +5

https://jsonformatter.org/ is complaining about the True's, try changing them to lowercase true.

That wasn't the issue, my code is in Python, and booleans are uppercase. The actual issue is there is a known defect in FME Server 2021 (Error: as FMESERVER-17589), the temporary fix is to include a empty request object in the payload.

 

This works:

params = {"request":{}, "begin":"2022-08-08T01:00:00", "name":"test", "description":"test", "skipUntilJobComplete":True, "enabled": True, "interval":2, "recurrence":"interval", "repository":"TEST", "workspace":"test.fmw", "unit":"MINUTE", "category":"Utilities"}

Reply