How do I retry incidents from java code?

I have a service task which is executing JavaDelegate code, from there I’m throwing exceptions so Camunda creates incidents after the set retries. From the Camunda cockpit I can see these incidents and retry them, how do I do this from Java? I’ve read failedJob types just need to be rexecuted by setting reties using /job/{id}/retries api, is there a version of this using java code using the process engine api?

I’ve seen some sample codes on querying the incidents and resolving but nothing about executing/retrying them

List<Incident> incidentContext = runtimeService.createIncidentQuery().list();
incidentContext.forEach(incident -> {
    // How do I retry here?

managementService.setJobRetries( incident.getConfiguration(), 1 );

Thank you, been searching for a while for that one.

Is there a document, like a table where it shows the REST API and the equivalent process engine API?

Also a follow up question, is the same code used if the incident type is failedExternalTask?