This article provides some tips to optimize the performance of your actions in LMS365 Cloud API, such as in your Power Automate flow or your Power App with Power Automate flows.
Reduce the use of the $expand action
The $expand field can be used to get specific data but for LMS365 API calls in a Power Automate flow, it's preferrable to use expands only for entities that can't be obtained in any other way.
A tip here is to have a clear vision of the exact data you need and obtain it from the relevant table, without using additional expand actions.
To find Enrollments for a specific user, filter the Enrollments table by UserId instead of expanding Enrollments in the Courses table, and filtering and searching for it there.
Similarly, you can't get Attendances for a specific user without expanding this entity in the Enrollments table, so we'll need to use it in our API call anyway.
Use the $select action
To obtain data from large tables, for example the Enrollments and Courses tables, the recommended path is to select only the parameters that will be used in a flow or the app. For this, you can use $select and specify the parameters to narrow the response data and the time it takes to return the data.
If you don't specify the relevant parameters, then you may encounter longer response times and a lot of data that isn't relevant in the response.
Expanding CourseSessions in your flow, you can improve performance by using $select in your query. To do this, specify parameters such as CourseSessions($select=Id,StartDateLocal,EndDateLocal). If parameters aren't specified, the flow may take longer because of the complexity of the TakenSeatsCount parameter.
Use a combination of actions
To enhance performance, instead of making complex queries that include multiple expands and filters, you could add several actions to the flow with separate responses that can be combined and analyzed later.
You have one API call that gets information from the Courses table, where you expand Enrollments for those courses. Within these enrollments, you can also expand CourseSessions. In this case, it's better to make two separate calls - one to get specific data from the Courses table, and the other to get enrollments from the expanded CourseSessions in the Enrollments table.
Plan your flow structure and options
When planning the structure of your flow and which parameters to use, think about where you can obtain the required data. This can help to find the most efficient way of getting the relevant response. Generally, the same data can be retrieved using different methods.
Finding the most efficient way of getting data will help you to improve the flow and app performance.
There are several ways to get data about a specific certificate, for example by expanding the Certificate entity in the Enrollments table and searching for the relevant certificate. However, if you already have the CourseId and UserId, the data can be obtained more efficient via the Certificates endpoint.
Avoid using UserLoginName
If you use UserLoginName, the flow could be complicated by the syntax. Find an example of the issue and how to fix it in this article.
A more efficient way is to use UserId or DirectoryObjectId in filters or in your flow actions.
Avoid using the CourseSession entity
The CourseSession is deprecated and can't be used any more. You'll need to remove it manually from the API request body. Use the CourseSessions entity instead.