Open gio1984 opened 11 months ago
Hi and thx for the report. Indeed, our RPA Framework Process library doesn't support pagination and server-side filtering, but your proposal looks valuable, so we'd be happy if you can help us with a PR. (here's our Dev Guide to get started)
Meanwhile, we just released a new API and we're working on wrapping it into a Python client in Robo, but this will take some time until it gets released and even backported here as well.
The function list_process_work_items doesn't retrieve all work items if they are more than 100. Additionally, it applies the filter after the request, so if it searches for "FAILED" items and the first 100 work items are all in the "COMPLETED" state, it will return an empty list. The API documentation says that the maximum value for "size" is 100 and to use "cursor" to retrieve the next pages. (https://robocorp.com/docs/control-room/apis-and-webhooks/api/process)
Probably, it could be fixed like this: data = None while True: response = requests.get(url=url_list_workitems, params=params, headers=calls_headers) response_json = response.json() if data == None: data = response_json["data"] else: data = data + response_json["data"] if response_json["nextCursor"] == None: break else: params["cursor"]= response_json["nextCursor"]