Hello,
I'm building a Custom Connector on a odata service. For listing rows I want to use Pagination. I've added the following to the OpenAPI definition.
x-ms-pageable:
nextLinkName: '@odata.nextLink'
By default the Odata API i'm calling does not have a @OData.nextLink element. So with Custom Code I construct the correct URL and add the nextLink in the response.
When I now use my action in Power Automate and enable pagination it just gets the first 2 pages.
- First it calls the Custom Connector to retrieve the first page. The Custom Code kicks in and adds the next link to the output
- The second page is retrieved immediately from the URL provided by the next Link. It does not call my custom connector or my custom code.
How do I know? I ended up with a Unauthorized error when pagination was enabled. When I put the correct authorization in the query string when constructing the next link the error went away. So no Authorization was added by the Custom Connector. Also, I added additional Custom Code for debugging, to make sure that my Custom Code is indeed not called.
What have I tried and/or found?
- I've looked at the x-ms-pageable docs in Autorest This mentioned that you can also supply 'operationName'. But trying to do this I get a validation error in de Custom Connector editor.
Specified swagger has the following errors: 'Definition is not valid. Error: 'Critical : paths/~1odata~1{entityName}/get/x-ms-pageable/operationName : The property 'operationName' is not allowed and must be removed.​
- I've looked at the underlying JSON Schema of the Custom connector on GitHub. There it document x-ms-pageable as well (and indeed does not include 'operationName'). It mentions the following as description for the nextlink url:
The name of the property at the root of the response that has the next link url.
Usage: Be sure to use the policy template (id: `updatenextlink`) to enable the correct routing of this link.
I'm unable to find any reference or documentation to policy template 'updatenextlink'.
- I've tried adding a '<operationName>Next' operation to my OpenAPI definition, as is indicated being the default operationName on x-ms-pageable. But you cannot have multiple operations on the same path with the same HTTP Verb. So I'm not sure how I would add this to my OpenAPI definition.
Who can help me get the paging working for my Custom Connector? What am I doing wrong? It needs to Custom Code in order to add the @OData.nextLink in de response. So it needs to call my Custom Connector to do so.