The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi. I've set up Copy Activity to pull data from an API, and having a hard time to paginate.
API looks like this :
https://serviceportal.telenorconnexion.com/iot/api/subscriptions/details?{some parameters}
This call's response contains "next" of next url to call, which looks like this :
{
~~
"next": "/details?q=CO~~~",
~~
}
-> just the end part of first call.
so "next" doesn't give FULL url to call.
So I've created Connection to this : https://serviceportal.telenorconnexion.com/iot/api/subscriptions
and set Relative URL to details?{some parameters} , and the first call goes fine.
I've done my research to paginate "next", and AbsoluteUrl looks like my solution, so I set up like this:
Then this error pops up:
ErrorCode=RestCallFailedWithServerError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with server error, status code 503 ServiceUnavailable, please check your activity settings and remote server issues.
Request URL: https://serviceportal.telenorconnexion.com/details?{some_parameter~~}
It pulls "next" value correctly, but call is being made to https://serviceportal.telenorconnexion.com/ , not https://serviceportal.telenorconnexion.com/iot/api/subscriptions that I've set the connection to.
Looks like in pagination, it pulls baseUrl(not using the connection is set to) from Connection somehow, then use to paginate.
I've tried making connection to https://serviceportal.telenorconnexion.com/ and start with
/iot/api/subscriptions/details/?q=~~~ in Relative URL, but shows same error. I can't find a way to put "/iot/api/subscriptions" in front of response's "next".
Anyone can help?
When you choose AbsoluteUrl in the pagination rules, the REST connector assumes that the "next" value returned from the API is the full URL to call next. It ignores both:
Since your "next" only contains the tail path, the connector starts building the request from the domain root, which explains why /iot/api/subscriptions disappears. Given your "next" is /details?... and you always need /iot/api/subscriptions before it, the RelativeUrl + concat() expression approach is the cleanest and does not require redesigning the pipeline.
"paginationRules": {
"absoluteUrl": null,
"relativeUrl": "@concat('/iot/api/subscriptions', json(activity('CopyDataFromAPI').output.response)['next'])"
}
Where:
Replace CopyDataFromAPI with your activity name
Ensure the json() path correctly extracts "next"
If you want, I can give you the exact JSON snippet for the Copy Activity Source that will prepend /iot/api/subscriptions on every "next" call so the connector never drops that segment again.
Please 'Kudos' and 'Accept as Solution' if this answered your query.
User | Count |
---|---|
3 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
5 | |
4 | |
3 | |
2 | |
2 |