Rest API End Condition in Copy Activity is not working

Philipp Kempter 56 Reputation points
2022-05-30T09:37:59.527+00:00

I'm working on a paginated get requestin adf. As soon as an EndCondtion is set, the request does not work anymore.

I'm using pagination rules in order to loop the request until all data is loaded. The range rule works fine but as soon as I add the EndCondtion the following error message appears:
ErrorCode=UserErrorMoreThanOneObjectsReturned,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=More than one objects returned\r\n

The empty response from the api are just two squere bracket: []. Is there a way to set the square bracket as endcondtion?

Thanks
Philipp

206686-image.png
206626-image.png
206687-image.png

206731-image.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,690 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ellie Coder 41 Reputation points
    2022-07-14T03:37:36.17+00:00

    I have found a workaround for this which may help others. It uses one of the headers to determine the end condition. I used Postman to view the headers of my API call on the first empty page after all records had been returned. I found a header called Content-Length which equals 2 when no data is being returned. The 2 represents the body '[]' in my case. I then set the pagination rules per the instructions in example 4.6 on this page: https://learn.microsoft.com/en-us/azure/data-factory/connector-rest?tabs=data-factory The settings I entered where:
    Name (1st box): End Condition
    Name (2nd box): headers.Content-Length
    Value (1st box): Const
    Value (2nd box): 2.

    220596-image.png

    The json for it looks like this:
    "paginationRules": {
    "AbsoluteUrl.{Page}": "RANGE:1::1",
    "EndCondition:headers.Content-Length": "Const:2"
    }

    8 people found this answer helpful.