How to replicate ManagementService.createJobQuery().withException() in Camunda 8.8?

In Camunda 7, I used the following code to retrieve jobs with exceptions for specific process instances:

managementService.createJobQuery()
.withException()
.processInstanceIds(processInstanceIds)
.orderByJobDueDate()
.list();

As I migrate to Camunda 8.8, I’m looking for a way to achieve the same functionality. Specifically, I’d like to query failed jobs by their processInstanceIds and sort them by due date.
Is there an equivalent API in Camunda 8, or a recommended approach to accomplish this?
Any guidance, best practices, or examples would be greatly appreciated.

Hi @Mkknowledge - I believe the “Search Jobs” endpoint with the state filter should get the same results:

However, there isn’t the same concept of a due date on non-user task jobs in Camunda 8, so the API doesn’t sort by due date. The docs page above lists the fields you can sort by.