Telize

BETAALD
Door Frederic Cambus | Bijgewerkt לפני 23 ימים | Location
Populariteit

9.8 / 10

Latency

83ms

Serviceniveau

100%

Health Check

N/A

Terug naar alle discussies

API always returns the same address in U.S

Rapid account: Kpgarrod
kpgarrod
לפני 8 שנים

I have used this api successfully until a few days ago. Now it is returning the same address from anywhere:

{“statusCode”:200,“body”:{“offset”:"-4",“longitude”:-77.4838,“city”:“Ashburn”,“timezone”:“America/New_York”,“latitude”:39.0335,“area_code”:“0”,“region”:“Virginia”,“dma_code”:“0”,“organization”:“AS14618 Amazon.com, Inc.”,“country”:“United States”,“ip”:“54.158.120.193”,“country_code3”:“USA”,“postal_code”:“20147”,“continent_code”:“NA”,“country_code”:“US”,“region_code”:“VA”},“headers”:{“access-control-allow-origin”:"*",“cache-control”:“no-cache”,“content-type”:“application/json; charset=utf-8”,“date”:“Fri, 29 Jan 2016 08:52:38 GMT”,“server”:“Mashape/5.0.6”,“x-ratelimit-requests-limit”:“1000”,“x-ratelimit-requests-remaining”:“954”,“content-length”:“350”,“connection”:“Close”},“request”:{“uri”:{“protocol”:“https:”,“slashes”:true,“auth”:null,“host”:“telize-v1.p.mashape.com”,“port”:443,“hostname”:“telize-v1.p.mashape.com”,“hash”:null,“search”:null,“query”:null,“pathname”:"/geoip",“path”:"/geoip",“href”:“https://telize-v1.p.mashape.com/geoip"},“method”:“get”,“headers”:{“X-Mashape-Key”:“ladt9aLl8amshlCarxuLVHrbwnajp1bYJW1jsnrmNgMMKHu7GS”,“Accept”:“application/json”,"content-length”:0}}}

I am in Malta! I have had somebody try it in India with the same result. This is a critical function and needs to work reliably.

Rapid account: Fcambus
fcambus Commented לפני 8 שנים

No problem at all, glad we could get this resolved and that everything is now working as it should.

Have a nice day 😃

Rapid account: Kpgarrod
kpgarrod Commented לפני 8 שנים

Thank you for pointing out the api key and please excuse my stupidity!

I really thought I had used this code on my staging system previously but it seems I must have been mistaken. It obviously worked on my localhost because that is where I am!

Anyway, it is now working correctly and I’m sorry to have wasted your time.

Rapid account: Fcambus
fcambus Commented לפני 8 שנים

Noticed you pasted an API key in the firsts messages. In case you didn’t obfuscate it, please regenerate a key as this issue is public.

Regards.

Rapid account: Fcambus
fcambus Commented לפני 8 שנים

In this case, you are detecting the IP address of the server hosting your application.

To get the visitor IP address, you need to call this endpoint (GeoIP with specific IP) and specify the IP address from your visitor as parameter.

So you need to replace the {ip_address} placeholder provided in the example by the IP address of the visitor.

Hope this helps.

Rapid account: Kpgarrod
kpgarrod Commented לפני 8 שנים

yes

Rapid account: Fcambus
fcambus Commented לפני 8 שנים

Are you making this API call from a Node.js application?

Rapid account: Kpgarrod
kpgarrod Commented לפני 8 שנים

No, I didn’t change the API call. This is what it looks like:

          unirest.get("https://telize-v1.p.mashape.com/geoip")
            .header("X-Mashape-Key", "myKey")
            .header("Accept", "application/json")
            .end((result) => {
              console.log(`result from mashape: ${JSON.stringify(result)}`)
Rapid account: Fcambus
fcambus Commented לפני 8 שנים

Did you change the way you call the API?

If the modification we made didn’t fix your issue, and you always see 54.158.120.193 in the results, it means that you are probably getting the IP address of the server hosting your application as a result.

Rapid account: Kpgarrod
kpgarrod Commented לפני 8 שנים

that’s UTC+2, so time is now

Rapid account: Kpgarrod
kpgarrod Commented לפני 8 שנים

Jan 29 12:10:29 result from mashape: {“statusCode”:200,“body”:{“offset”:"-4",“longitude”:-77.4838,“city”:“Ashburn”,“timezone”:“America/New_York”,“latitude”:39.0335,“area_code”:“0”,“region”:“Virginia”,“dma_code”:“0”,“organization”:“AS14618 Amazon.com, Inc.”,“country”:“United States”,“ip”:“54.158.120.193”,“country_code3”:“USA”,“postal_code”:“20147”,“continent_code”:“NA”,“country_code”:“US”,“region_code”:“VA”},“headers”:{“access-control-allow-origin”:"*",“cache-control”:“no-cache”,“content-type”:“application/json; charset=utf-8”,“date”:“Fri, 29 Jan 2016 10:10:29 GMT”,“server”:“Mashape/5.0.6”,“x-ratelimit-requests-limit”:“1000”,“x-ratelimit-requests-remaining”:“947”,“content-length”:“350”,“connection”:“Close”},“request”:{“uri”:{“protocol”:“https:”,“slashes”:true,“auth”:null,“host”:“telize-v1.p.mashape.com”,“port”:443,“hostname”:“telize-v1.p.mashape.com”,“hash”:null,“search”:null,“query”:null,“pathname”:"/geoip",“path”:"/geoip",“href”:“https://telize-v1.p.mashape.com/geoip"},“method”:“get”,“headers”:{“X-Mashape-Key”:“ladt9aLl8amshlCarxuLVHrbwnajp1bYJW1jsnrmNgMMKHu7GS”,“Accept”:“application/json”,"content-length”:0}}}

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen