Search code examples
node.jsgoogle-api-nodejs-clientyelp-fusion-api

Multiple api call


I'm trying to build a nodejs app that runs and if statement to query multiple api's to return a result. Example, running yelps api first, if it finds then break, else continue query another api such as google places or white pages api until it finds a result.

I am passing in either a name of a business, address to return a telephone number. the results expected are in json. I am drawing a blank.

ideas?


Solution

  • so the way to achieve this is you should be able to make http req from your server side and when a result comes with a response then you should check that response. If your requested answer is not in it then you should keep on trying other API end points untill u come across with a suitable response..

    so here are some npm packages to achieve this simply

    • http - node js built in package
    • Axios - here
    • request - here

    try using one of these packages .. I would use axios .. read their doc and try to do it .. It should clear somethings out for you