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?

1 Answer 1

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)
  })

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.