Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.

Get latest usages first

Hi!

I am using the soap method GetUserDetailedUsage to get the latest usages for a user. I need the latest usage first. how can i change the sorting of the response-objects?

Thanks, stefan

Answers

  • Mark BrewsalaMark Brewsala Panopto Employee
    edited March 2022

    Hi Stefan,

    There's no way to change the sort on the response object today: it's always in chronological order. One could argue that the sort should actually be in reverse chronological order to make the default call more meaningful (though then it's much less deterministic and possibly also harder to parse).

    However, there are two workarounds that could help.

    First, the API takes a Pagination object which allows you to change the number of response objects returned and the page number of results. The default page size is 25 and the default page number is 0, so by default the first 25 results are returned. And, each response (regardless of any other settings) will tell you the total number of results. Suppose the first call tells you there are 150 total results. Then, you could change MaxNumberResults to 50 and PageNumber to 2 to get the most recent 50 results on a subsequent call. Of course that doesn't tell you how recent those results are; but you could start to binary search within the result set to get to a target date range, or store the results yourself in a persistent storage you control so you know where you left off any time you want to use the API again.

    Second, there is another API that returns a superset of the data that this API returns: GetUserExtendedDetailedUsage. Each response object contains additional data fields, but the sourcing of the data is the same as with GetUserDetailedUsage. The benefit of using GetUserExtendedDetailedUsage though is that it allows you to specify a date range for the result set. Again, you would need to know the date range of interest, but at the least you could always call the API with endRange equal to the current time and then walk backward in time as long as needed (through a combination of changing Pagination settings and beginRange as needed).

    Absent a compelling need, we won't be making changes or improvements to the SOAP API. If you feel the above workarounds are insufficient and you have a compelling need for additional functionality, please contact your customer success advocate or open a support ticket to explain your scenario in more detail.

    Thanks,

    Mark

Sign In or Register to comment.