WebexPythonSDK icon indicating copy to clipboard operation
WebexPythonSDK copied to clipboard

Item list pagination: url returned by the webex teams api is not complete

Open oOraph opened this issue 4 years ago • 3 comments

The sdk automatically handles the pagination for us by reusing the link: ; rel="next" header. However the returned one can be incorrect when some parameters are specifed

The object listing can be broken or worse, can succeed while ignoring the filtering parameters for pages above the first one.

Example: a bot needs to specify mentionedPeople=me to be allowed to list room messages. If there are several pages to be returned, then the listing will fail because the mentionedPeople query parameter won't be specified when fetching the next pages

To reproduce: create a room add a bot, post more than 10 messages for the specified bot. Attempt to list messages through the webexteamssdk using the bot token

This will result in a 403 message -> can directly be manually reproduced by checking the link header in the api response (because of the missing mentionedPeople param)

The bug is actually an api bug more than an sdk one. Yet we can give a fix proposal on sdk side by reusing and amending the def _fix_next_url method in restsession.py

oOraph avatar Nov 05 '21 13:11 oOraph

Tests not ran nor checked

oOraph avatar Nov 05 '21 13:11 oOraph

Can we get this merged please? This is pretty significant issue for bot use cases - the fix works for me, FWIW.

gve-vse-tim avatar Jan 14 '22 17:01 gve-vse-tim

This is a good idea - even as we are very late picking it up. Let me see if I can get it in the v1.7 release.

cmlccie avatar Feb 19 '24 18:02 cmlccie

Already merged.

cmlccie avatar Mar 31 '24 04:03 cmlccie