Retrieving previous and next task!

Can anyone help me to understand how do i fetch the immediate previous and next tasks given a particular task. Note that all tasks are Human Tasks in nature!

Hi
Check out this Documentation.
https://documentation.bonitasoft.com/6.x-7.2/bpm-api#humantask - Available Task
https://documentation.bonitasoft.com/6.x-7.2/bpm-api#archivedtask - Completed Task

Regards

Can you update the question on whether you need it in REST API or Java API?