I have a API which returns a array of objects. Each object details should be fetched by making another API call. sample JSON:
{
"next": "https://sample.com/api/unit/?page=2",
"results": [
{
"name": "test",
"fruit": [
"https://sample.com/api/pi/fruit/1/",
"https://sample.com/api/fruit/2/",
"https://sample.com/api/fruit/4/",
"https://sample.com/api/fruit/6/",
"https://sample.com/api/fruit/7/",
"https://sample.com/api/fruit/8/",
],
"vegs": [
"https://sample.com/api/veg/1/",
"https://sample.com/api/veg/3/",
"https://sample.com/api/veg/4/",
"https://sample.com/api/veg/5/",
"https://sample.com/api/veg/6/"
],
"created": "2014-12-09T13:50:49.641000Z",
"edited": "2014-12-20T20:58:18.411000Z",
"url": "https://sample.com/api/food/1/"
},
{
"name": "test2",
"fruit": [
"https://sample.com/api/pi/fruit/9/",
"https://sample.com/api/fruit/10/",
"https://sample.com/api/fruit/11/"
],
"vegs": [
"https://sample.com/api/veg/6/",
"https://sample.com/api/veg/18/",
"https://sample.com/api/veg/14/"
],
"created": "2014-12-09T13:50:49.641000Z",
"edited": "2014-12-20T20:58:18.411000Z",
"url": "https://sample.com/api/food/1/"
},
{
"name": "test3",
"fruit": [
"https://sample.com/api/pi/fruit/1/",
"https://sample.com/api/fruit/13/",
"https://sample.com/api/fruit/14/",
"https://sample.com/api/fruit/16/",
"https://sample.com/api/fruit/17/",
"https://sample.com/api/fruit/18/",
],
"vegs": [
"https://sample.com/api/veg/7/",
"https://sample.com/api/veg/8/",
"https://sample.com/api/veg/9/",
"https://sample.com/api/veg/10/",
"https://sample.com/api/veg/13/"
],
"created": "2014-12-09T13:50:49.641000Z",
"edited": "2014-12-20T20:58:18.411000Z",
"url": "https://sample.com/api/food/1/"
}
]
}
API cannot be changed, so I will have to make all these calls. On top of that support pagination for this response. Any suggestions to make this API call optimal would be great