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.
2) Stop Permission inheritance of the Item.
3) Iterate over all the Item Permissions >> Remove Them >> Reassign them with Read.
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:-
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: -
Q1) 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?
Q2) 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:-
1) Improve the performance
2) Force my power automate flow to do less Requests. keeping in mind that doing an API call to SharePoint is considered as one request, also initializing a variable or setting a variable is considered as 1 request also.
Thanks in advance for any help.
Regards
Attached is the code for the Body request, as i am unable to post the code here