Jan 21, 2021 09:37 AM
hello everyone, sorry if my english is not very good, i will try to explain my problem to you.
I would like to retrieve the longitude and latitude through a script on airtable using an api but i dont know how to do it, can you help me please i am really stuck.
thank you
Jan 27, 2021 06:03 AM
Hello, I have tried with another API.
here is the code:
fetch(“https://ip-geolocation-ipwhois-io.p.rapidapi.com/json/”, {
"method": "GET",
"headers": {
"x-rapidapi-key": "c7bd31779emshe2f681be6a371a4p111f02jsn3cbcfa506bae",
"x-rapidapi-host": "ip-geolocation-ipwhois-io.p.rapidapi.com"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});
the problem is that airtable returns nothing to me
Jan 29, 2021 06:09 AM
Works fine for me. The problem is not Airtable - it’s your code. You need to do something to show the response from the API call.
output.markdown('# Rapid API Example');
let host = "ip-geolocation-ipwhois-io.p.rapidapi.com";
let accessKey = "c7bd31779emshe2f681be6a371a4p111f02jsn3cbcfa506bae";
let url = "https://ip-geolocation-ipwhois-io.p.rapidapi.com/json/";
let options = {
"method": "GET",
"headers": {
"x-rapidapi-key": accessKey,
"x-rapidapi-host":host
}
}
await fetch(url, options)
.then((resp) => resp.json())
.then(function(data) {
output.inspect(data);
})
.catch(function(e) {
output.markdown(e.message);
});
Feb 05, 2021 04:21 AM
Thanks for your help