Forum Discussion

deeps's avatar
deeps
New Contributor III
2 years ago

Rest GET/HTTP Client trying to increment page number but after second iteration it's appending.

First response
"headers":
{
"Server":"opentest"
"Date": "Thu, 02 May 2024 03:54:38 GMT"
"Content-Type":"application/json"
"Transfer-Encoding":"chunked"
"Vary":"Accept-Encoding"
"X-Current-Page":"0"
"X-Page-Count":"9"
"X-Page-Size":"2000"
"X-Total-Count":"17139"
........
}
second response/iteration
"headers":{
"Server":"opentest"
"Date": "Thu, 02 May 2024 03:54:38 GMT"
"Content-Type":"application/json"
"Transfer-Encoding":"chunked"
"Vary":"Accept-Encoding"
"X-Current-Page":"1"
"X-Page-Count":"9"
"X-Page-Size":"2000"
"X-Total-Count":"17139"
........
}
Third response/iteration
"headers":{
"Server":"opentest"
"Date": "Thu, 02 May 2024 03:54:38 GMT"
"Content-Type":"application/json"
"Transfer-Encoding":"chunked"
"Vary":"Accept-Encoding"
"X-Current-Page":"11"
"X-Page-Count":"1"
"X-Page-Size":"0"
"X-Total-Count":"0"
........
}
Has Next - parseInt($headers['X-Page-Size'])* snap.out.totalCount < $headers['X-Total-Count']
Next URL - "URL"+parseInt($headers['X-Current-Page']) + 1
Looks like my datatype for X-Current-Page is String and it's unable to convert to INT after second iteration.
Tried both HTTP Client & REST Get.
Can you please help. 


I tried methods mentioned in here https://community.snaplogic.com/t5/data-integration/rest-get-pagination-in-various-scenarios/td-p/25771