Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, i'm using an REST API call in my script with a standard SQL SELECT statement, but my API using response HEADER with totalcount and offset to manage pagination.
How can i read those response header from my script ?
Thanks T.
I guess you setup is simile to the one I use to do
I would to to the table set up in the connection and look at the structure.
Then
1. Set up your REST connection with pagination type set to Custom.
The try to play with offset and loops
SET vOffset = 0;
SET vPageSize = 100;
Data:
LOAD *
FROM [Your Connection]
WITH CONNECTION (
URL "https://your.api.endpoint?offset=$(vOffset)&limit=$(vPageSize)"
);
LET vRowCount = NoOfRows('Data');
IF $(vRowCount) = 0 THEN
EXIT Do
ENDIF
Concatenate(MainTable)
LOAD * RESIDENT Data;
DROP TABLE Data;
LET vOffset = $(vOffset) + $(vPageSize);
Loop
Thank for your answer, i had test this way but my api always return rows by cycling over the data. So i can't use NoOfRows to determinate the end, I've to read an header in response call 'x-pagination-size' who content the total count of rows in data.
Do you have an idea to read response header ?
T.