Telize

유료
분류별 Frederic Cambus | 업데이트됨 il y a 22 jours | Location
인기

9.8 / 10

지연 시간

83ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

API always returns the same address in U.S

Rapid account: Kpgarrod
kpgarrod
il y a 8 ans

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 il y a 8 ans

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 il y a 8 ans

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 il y a 8 ans

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 il y a 8 ans

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 il y a 8 ans

yes

Rapid account: Fcambus
fcambus Commented il y a 8 ans

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

Rapid account: Kpgarrod
kpgarrod Commented il y a 8 ans

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 il y a 8 ans

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 il y a 8 ans

that’s UTC+2, so time is now

Rapid account: Kpgarrod
kpgarrod Commented il y a 8 ans

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

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입