DSpace 7.1 - REST API for approving or rejecting item

148 views
Skip to first unread message

Aar Cee

unread,
Feb 7, 2022, 7:55:05 AM2/7/22
to DSpace Technical Support
DSpace 7.1 - Is there a REST API available for approving or rejecting an Item?

We have a scenario where we have a manual reviewer workflow task which can also be completed programmatically based on certain external event. Pls suggest if there is any endpoint to approve item programmatically.

Thanks!

Tim Donohue

unread,
Feb 7, 2022, 10:39:40 AM2/7/22
to DSpace Technical Support
Hi,

Yes, every action available in the User Interface is possible via the REST API.  Sometimes the easiest way to find the correct REST endpoints to use is to open your browser's DevTools and watch the Network tab, as it'll include every request made to the REST API each time you perform an action in the UI.

In terms of approving/rejecting items, you'd have to use several endpoints.

First, you *MUST* have a Workflow Item created.. 
It's possible this is already happening automatically though, if you have a Collection with workflows enabled.

Once a WorkflowItem exists, a number of PoolTasks (i.e. workflow tasks in a pool, waiting to be claimed) will be generated. These are only visible to people who are able to act on the Item while it's in workflow. https://github.com/DSpace/RestContract/blob/main/pooltasks.md

A PoolTask must be *claimed* by someone, before they can work on it. That turns it into a ClaimedTask: https://github.com/DSpace/RestContract/blob/main/claimedtasks.md#post-method

Once it's a ClaimedTask you can perform an action on it, including approval/rejection: https://github.com/DSpace/RestContract/blob/main/claimedtasks.md#post-method-single-resource-level

There's a lot more that can be done here, obviously, but that's the basics of the "flow".  I'd highly recommend using your Browser's DevTools to look at each request made when performing these actions from the UI...it's possible I forgot a step or simplified something here.

If you have further questions, feel free to ask on this list.

Good luck,

Tim


Carlos De Santis

unread,
Nov 13, 2023, 10:19:00 AM11/13/23
to DSpace Technical Support

Thank you very much for the publication regarding the workflow to approve an item.

Is there a way to move the collection item?

Thank you.

DSpace Technical Support

unread,
Nov 16, 2023, 12:15:21 PM11/16/23
to DSpace Technical Support
Hi,

I've just written a guide for locating which REST API endpoints to use for any action in DSpace. It can be done easily by just watching which requests the User Interface makes to the REST API when you perform a task in the User interface.
Reply all
Reply to author
Forward
0 new messages