0

Hi since I am a novice this problem might be small but I could not find any solution.

    axios.get('http://apilayer.net/api/validateaccess_key=******&number=14158586273&country_code=&format=1')
    .then(response=>{
        console.log(response.data);
    }).catch(error =>{
        console.log(error)
    })

Now I wanted to make a bulk phone number validation program and I want to send different number through the url every time, the numbers are stored in an array. How to set a dynamic parameter to send different phone number from an array of numbers through the url?

aleksxor
  • 7,535
  • 1
  • 22
  • 27
Predictev
  • 1
  • 1

1 Answers1

0

You can do like this:

const API_PATH = 'http://apilayer.net/api/';
const numbers = ['14158586273', '14158586274', '14158586275', ...]
const paramsData = {
    validateaccess_key: '******',
    number: numbers[0], // your desired number here
    country_code: 123,
    format: 1
}


axios.get(API_PATH, { params: paramsData })
  .then(response => {
    console.log(response.data);
  }).catch(error =>{
    console.log(error)
  })