json - Nested API calls PHP -
i make api call return list of items. use foreach loop iterate json data:
foreach($decoded_results['items'] $item) { $image_link = $item['thumb']; $link_url = $item['url']; $subject = $item['title']; }
i need additional information each item , in order need call endpoint.
in first response every item in json object has property id
corresponds property same id
in other json object, response when call second endpoint. id needed parameter in query string second api call.
what best approach accomplish this? i've looked curl_multi
little bit not sure if suitable situation.
the best solution if second api has endpoint accepts list of ids , can return information need in 1 call, otherwise known the n+1 problem in database management, same here , not optimal solution.
Comments
Post a Comment