Reputation: 236
I have this Child Power Automate flow that is been called 3,000 times each day from different automated and scheduled flow all over our solution.
The flow manually does those main actions: -
As follow: -
So now if we take an example where the list item has 7 permission been granted to it from the list, then the flow will be performing those number of requests: -
1 request to Break the Permission Inheritance
1 request to Get all Permissions (For example 7 permissions)
2 Requests inside each ApplyToEeach Iteration, so total requests will be 14
So total requests for each flow run will be = (1 + 1 + 14) = 16 requests
Now i am trying to use Batch calls to reduce the number of requests been generated + improve the performance.
Here is my plan :-
1- Combine the first 2 calls into one POST Patch call, as follow:-
--batch_1234
Content-Type: multipart/mixed; boundary="changeset_1234"
--changeset_1234
Content-Type: application/json
Content-Type: application/http
Content-Transfer-Encoding: binary
POST https://**.sharepoint.com/_api/web/lists/GetByTitle('WorkOrder')/items(1)/breakroleinheritance(true) HTTP/1.1
--changeset_1234
Content-Type: application/json
Content-Type: application/http
Content-Transfer-Encoding: binary
POST https://**.sharepoint.com/_api/web/lists/GetByTitle('WorkOrder')/items(2)/roleassignments/roleassignments HTTP/1.1
--changeset_1234--
--batch_1234--
2- Combine the 2 actions of removing the Permission and reassign them with Read, by one Batch call.
3- So, the flow should be doing those numbers of calls: -
1-Batch-Call + (1 * 7) = 8 requests
instead of 16. which is a good way to start with.
But I have those 2 main questions: -
When I do the first Batch call, how I can get the results from calling the second POST request, which is responsible for getting all the permission items after breaking the permission inheritance, so i can loop thorough them?
If I want to be more optimistic, can I combine all the calls inside the loop into one Batch? so my flow will be only running 2 requests?
My plan to do 2 main improvements:-
Thanks in advance for any help.
Regards
Upvotes: 0
Views: 64