Search code examples
node.jsjsoncurlpostchainlink

Want to access wins data in JSON body , can`t find the right path to the result?


I'm developing this external adapter for my Chainlink node. From RapidAPI I call a POST API call based on the name field. This is the returned body.

enter image description here In node.js I will like to retrieve "wins" in "data" array:

>     Requester.request(options, customError)
>         .then(response => {
>          
>           response.data.result = Requester.validateResultNumber(response.data,['data', 'performance','wins'])
>           callback(response.status, Requester.success(jobRunID, response))
>         })

But I'm getting the :

AdapterError: TypeError: Cannot read property 'wins' of undefined

What path do I need to write to get to my result ?


Solution

  • Found the path with : ["data", "0", "performance", "wins"].