variables Scenario 4 — API Pagination with Token and Page Variables
Written by RTILA X Engineering Team
What You'll Learn
Manipulate lists with push and pop
Real-World Use Case
Collecting URLs during a crawl
API Pagination
Five pages of the same scenario navigated via path segments /4/2 … /4/5, with a repeat loop and math_operation.
All API Page Data
| id | name | value |
|---|---|---|
| 1 | Alpha | A1 |
| 2 | Beta | B2 |
| 3 | Gamma | C3 |
| 4 | Delta | D4 |
| 5 | Epsilon | E5 |
| 6 | Zeta | F6 |
| 7 | Eta | G7 |
| 8 | Theta | H8 |
| 9 | Iota | I9 |
| 10 | Kappa | J10 |
| 11 | Lambda | K11 |
| 12 | Mu | L12 |
| 13 | Nu | M13 |
| 14 | Xi | N14 |
| 15 | Omicron | O15 |
| 16 | Pi | P16 |
| 17 | Rho | Q17 |
| 18 | Sigma | R18 |
| 19 | Tau | S19 |
| 20 | Upsilon | T20 |
| 21 | Phi | U21 |
| 22 | Chi | V22 |
| 23 | Psi | W23 |
| 24 | Omega | X24 |
| 25 | Lambda2 | Y25 |
RTILA X Automation Project
{
"name": "API_Pagination_Token_And_Page",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/variables/4"
],
"variables": [
{
"name": "api_token",
"required": true,
"value": "demo-token-abc123"
}
]
},
"datasets": {
"api_page_data": {
"item_selector": "css=table.api-page-data tbody tr",
"properties": [
{
"name": "id",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "name",
"type": "text",
"selector": "css=td:nth-child(2)"
},
{
"name": "value",
"type": "text",
"selector": "css=td:nth-child(3)"
}
]
}
},
"commands": [
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/variables/4?token=${api_token}"
}
},
{
"command": "extract_data",
"params": {
"dataset": "api_page_data"
}
},
{
"command": "set_variable",
"params": {
"name": "page_num",
"value": "2"
}
},
{
"command": "repeat",
"params": {
"times": 4,
"do": [
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/variables/4/${page_num}?token=${api_token}"
}
},
{
"command": "extract_data",
"params": {
"dataset": "api_page_data"
}
},
{
"command": "math_operation",
"params": {
"left_operand": "${page_num}",
"operator": "+",
"right_operand": "1",
"output_variable": "page_num"
}
}
]
}
}
]
}
API pagination often uses auth tokens and page numbers. The variables
are inserted into each request URL and updated after every page
extraction. Here pagination happens on this very site: each request
loads /scenarios/variables/4/[page]?token=… (for
example /scenarios/variables/4/2), every page is pre-rendered as
static HTML with its own table, and the extraction selectors keep
matching the rendered rows.
Did you complete this scenario?
Ready to run this automation?
Copy the project JSON above, open RTILA X, create a new project, and paste it.
This scenario covers 1 RTILA X command and is referenced in 2 learning articles.
Continue Learning
Was this helpful?
Thank you for your feedback!