Usecase: Here, we will get Rest data in 500 records size chunks using limit and offset.
Limitation:
Oracle REST APIs can return only 499 (<500) records in a single request. But in Fusion, there may be more than 499+ records so we need to fetch all records
Solution:
We need to make use of Oracle REST APIs parameters like offset and limit and call REST API in the loop until hasMore attribute in the response is false.
Sample Request URL to test rest:
https://servername.fa.us2.oraclecloud.com/fscmRestApi/resources/latest/invoices?fields=InvoiceNumber,InvoiceCurrency&onlyData=true&links=self&limit=1&offset=0
Operation: GET
Response
{
"items": [
{
"InvoiceNumber": "test23",
"InvoiceCurrency": "USD"
}
],
"count": 1,
"hasMore": true,
"limit": 1,
"offset": 0,
"links": [
{
"rel": "self",
"href": "https://servername.fa.us2.oraclecloud.com:443/fscmRestApi/resources/11.13.18.05/invoices",
"name": "invoices",
"kind": "collection"
}
]
}
Implementaion steps:
- Create a new Scheduled integration and assign all the required variables offset=0, limit= 500, hasMore="true", onlyData="true", links="self", fields="InvoiceNumber,InvoiceCurrency"
- Take a stage and write the headers
- Take a while and loop till hasMore != "false"
- Configure rest endpoint to get the invoice data with the qurey params
- URI: fscmRestApi/resources/latest/invoices
- Query params: fields,onlyData,links,limit, offset
- Json response
- Map the fields
- Take a stage and write invoices
- Take a assign and update:
- hasMore= from the inboice response hasMore,
- offset = $offset + 500
- Take a ftp adapter and configure to write final response.
Detailed steps with screenshots:
Integration flow:
Assign globals
Write headers
Loop
Get rest call