@jeans it's based on third-party API. If it can't return product details for multiple id at a time - you need to do separate call per each product.
Related to API (Avoid using forloop)
Hey,
I am fetching data from a third-party API and inserting it into the database. Using two APIs.
- Product list API
- Product detail API
I have faced an issue is that when I get data from product list API. It returns me 100 records but on those records, some parameters are not available which I need to use it. So for that purpose, I fetched the required data parameters through detail API by calling inside the for loop.
Like First, I get all product IDs using product list API. After that, I run the for loop and pass those ids in the detail API then make a method for adding those data into the database but this approach is not good. In this approach, I have to hit the API 100 times.
foreach ($getAnimalId as $value) {
$animalId = intval($value)'
$detailLostAnimal = $this->detailPetPointAnimal($animalId);
$this->addAnimals($$detailLostAnimal);
}
So, Please guide me on how I can get data without using forloop. Below the code
Please or to participate in this conversation.