Ghid API iplocate
API-ul nostru ofera informatii cu privire la o adresa IP utilizand o interfata REST care returneaza urmatoarele date:
- hostname
- proprietar
- nume continent, cod continent
- nume stat, cod stat
- nume regiune, cod regiune
- nume tinut, judet
- nume oras
- latitudine, longitudine
- fus orar
- limba oficiala
- valuta
Cerere
Apelarea API-ului iplocate este intuitiva si usor de realizat. Realizeaza o cerere adaugand parametrii valizi pentru interogarea ta:
https://api.iplocate.com/ip/«ip_address»/key/«api_key»/output/«format»/timezone/«bool»/hostname/«bool»/language/«bool»/currency/«bool»
parametrii pot fi precizati in orice ordine in URL
Parametri
Parametru | Necesar | Valoare implicita | Descriere |
---|---|---|---|
ip | nu | adresa IP client | adresa IP |
key | da | null | cheia primita la inregistrarea unei aplicatii |
output | nu | xml | specifica formatul corespunzator raspunsului: xml, json, raw |
timezone | nu | false | specifica prezenta fusului orar in raspuns: true, false |
hostname | nu | false | specifica hostname in raspuns: true, false |
language | no | false | specifica limba oficiala in raspuns: true, false |
currency | no | false | specifica valuta in raspuns: true, false |
Pentru a obtine o cheie valida pentru aplicatia sau site-ul tau, te rugam sa inregistrezi un cont de utilizator iplocate.
Raspuns
Element | Descriere |
---|---|
ip | adresa IP referita |
hostname | hostname-ul pentru adresa IP furnizata |
owner | proprietarul pentru adresa IP furnizata |
continent_name | nume continent |
continent_code | cod continent |
country_name | nume stat conform ISO-3166 |
country_code | cod stat pe doua caractere conform ISO-3166 |
region_name | nume regiune |
region_code | cod regiune |
county_name | nume tinut, judet |
city_name | nume oras |
latitude | latitudinea corespunzatoare locatiei identificate, in care numerele pozitive reprezinta Nordul, iar numerele negative reprezinta Sudul |
longitude | longitudinea corespunzatoare locatiei identificate, in care numerele pozitive reprezinta Estul, iar numerele negative reprezinta Vestul |
timezone | fus orar |
Implicit, API-ul iplocate trimite raspunsurile in format XML. Poti solicita raspunsul si in format JSON sau text (RAW)
Exemplu raspuns XML
<response> <status>Propper Request</status> <message>Success</message> <notes>The following results has been returned</notes> <code>200_1</code> <location> <ip>8.8.8.8</ip> <owner>LEVEL 3 COMMUNICATIONS INC</owner> <continent_name>NORTH AMERICA</continent_name> <continent_code>NA</continent_code> <country_name>UNITED STATES</country_name> <country_code>US</country_code> <region_name>CALIFORNIA</region_name> <region_code>CA</region_code> <county_name>SANTA CLARA</county_name> <city_name>MOUNTAIN VIEW</city_name> <latitude>37.3801</latitude> <longitude>-122.0865</longitude> <timezone>PST</timezone> </location> <languages> <language> <alpha2_code>EN</alpha2_code> <alpha3_code>ENG</alpha3_code> <language_name>ENGLISH</language_name> <native_name>ENGLISH</native_name> </language> </languages> <currencies> <currency> <alpha_code>USD</alpha_code> <numeric_code>840</numeric_code> <currency_name>US DOLLAR</currency_name> <currency_symbol>$</currency_symbol> <fractional_unit>CENT</fractional_unit> </currency> </currencies> <unit_test> <elapsed_time>0.0609</elapsed_time> <memory_usage>0.76MB</memory_usage> </unit_test> </response>
Exemplu raspuns JSON
{ "response": { "status": "Propper Request", "message": "Success", "notes": "The following results has been returned", "code": "200_1", "location": { "ip": "8.8.8.8", "owner": "LEVEL 3 COMMUNICATIONS INC", "continent_name": "NORTH AMERICA", "continent_code": "NA", "country_name": "UNITED STATES", "country_code": "US", "region_name": "CALIFORNIA", "region_code": "CA", "county_name": "SANTA CLARA", "city_name": "MOUNTAIN VIEW", "latitude": "37.3801", "longitude": "-122.0865", "timezone": "PST" }, "languages": { "language": [ { "alpha2_code": "EN", "alpha3_code": "ENG", "language_name": "ENGLISH", "native_name": "ENGLISH" } ] }, "currencies": { "currency": [ { "alpha_code": "USD", "numeric_code": "840", "currency_name": "US DOLLAR", "currency_symbol": "$", "fractional_unit": "CENT" } ] }, "unit_test": { "elapsed_time": "0.0609", "memory_usage": "0.76MB" } } }
Exemplu raspuns RAW
Propper Request,Success,The following results has been returned,200_1, 8.8.8.8,LEVEL 3 COMMUNICATIONS INC,NORTH AMERICA,NA,UNITED STATES,US,CALIFORNIA,CA,SANTA CLARA,MOUNTAIN VIEW,37.3801,-122.0865,PST, languages,1,EN,ENG,ENGLISH,ENGLISH, currencies,1,USD,840,US DOLLAR,$,CENT, unit_test,0.609,0.76MB
Cod | Status | Mesaj | Descriere |
---|---|---|---|
200_1 | Propper Request | Success | The following results has been returned. |
200_2 | Propper Request | Not Found | No result set has been returned. |
Mesaje de eroare
Daca o cerere nu se realizeaza cu succes, API-ul iplocate returneaza un mesaj de eroare. Implicit, mesajul este returnat in format XML, dar sunt disponibile si formatele JSON sau RAW.
<error> <status>status</status> <message>message</message> <notes>notes</notes> <code>code</code> <unit_test> <elapsed_time>time</elapsed_time> <memory_usage>memory</memory_usage> </unit_test> </error>
Cod | Status | Mesaj | Descriere |
---|---|---|---|
400_1 | Bad Request | Error in the URI | The API call should include a API key parameter. |
400_2 | Bad Request | Error in the URI | The API call should include a valid IP address. |
403_1 | Forbidden | Not Authorized | The API key associated with your request was not recognized. |
403_2 | Forbidden | Account Inactive | The API key has not been approved or has been disabled. |
403_3 | Forbidden | Limit Exceeded | The service you have requested is over capacity. |
Planuri tarifare
Alege planul potrivit pentru tine
Serviciul de tip IP Intelligence iplocate ofera o varietate de planuri tarifare pentru a satisface nevoile tale: Developer, Basic, Professional, Enterprise. Pentru mai multe detalii, verifica planurile tarifare.