Genel Bakış
NosyAPI Ülkelerin Telefon Kodlarını, Timezone ve Şehirleri API dökümantasyonuna hoşgeldiniz.
Bu dökümantasyonu ile ülkelerin timezone değelerine ve telefon kodlarına ulaşabilirsiniz.
İçindekiler
- API Token Bilgileri
- Ülkeleri Listeleme (Timezone ve Telefon Kodları) - İstek
- Ülkeleri Listeleme (Timezone ve Telefon Kodları) - Örnek Kodlar
- Ülkelerin Şehirlerini Listeleme - İstek
- Ülkelerin Şehirlerini Listeleme - Örnek Kodlar
API Token Bilgileri
API kullanımı için token bilgisine ihtiyaç duymaktayız. Bu token bilgisi ile istediğiniz bilgileri çekebilirsiniz. API kullanımı için token bilgisine ihtiyaç duymaktayız. Token bilginizi menüde yer alan API Bilgilerim bölümünden alabilirsiniz.
Ülkeleri Listeleme (Timezone ve Telefon Kodları) - İstek
İstek |
---|
GET - https://www.nosyapi.com/apiv2/countries/getCountryList |
Örnek Kodlar |
---|
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.nosyapi.com/apiv2/countries/getCountryList',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location --request GET 'https://www.nosyapi.com/apiv2/countries/getCountryList' \
--header 'Authorization: Bearer API_KEY'
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://www.nosyapi.com/apiv2/countries/getCountryList");
xhr.setRequestHeader("Authorization", "Bearer API_KEY");
xhr.send();
var client = new RestClient("https://www.nosyapi.com/apiv2/countries/getCountryList");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer API_KEY");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.get("https://www.nosyapi.com/apiv2/countries/getCountryList")
.header("Authorization", "Bearer API_KEY")
.asString();
import http.client
conn = http.client.HTTPSConnection("www.nosyapi.com")
payload = ''
headers = {
'Authorization': 'Bearer API_KEY'
}
conn.request("GET", "/apiv2/countries/getCountryList", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://www.nosyapi.com/apiv2/countries/getCountryList")!,timeoutInterval: Double.infinity)
request.addValue("Bearer API_KEY", forHTTPHeaderField: "Authorization")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Diğer programlama dilleri veya Postman çıktısı için lütfen info@nosyapi.com adresine mail atınız.
Not: API_TOKEN yazan yerleri kendi token bilginizle değiştirmeyi unutmayınız.
Yanıt ve Tipleri |
---|
{
{
"status": "ok",
"systemTime": 1607171009,
"message": "ok",
"rowCount": 442,
"data": [
{
"CountryID": 1,
"name": "Afghanistan",
"shortName": "AF",
"phoneCode": 93,
"timeZone": "Asia/Kabul"
},
{
"CountryID": 2,
"name": "Albania",
"shortName": "AL",
"phoneCode": 355,
"timeZone": "Europe/Tirane"
},
{
"CountryID": 3,
"name": "Algeria",
"shortName": "DZ",
"phoneCode": 213,
"timeZone": "Africa/Algiers"
}...
]
}
Alan | Açıklama | Veri Tipi |
---|---|---|
CountryID | Diğer istekte kullanacağınız ülke kodudur. | string |
ShortName | Kısa adını vermektedir. | string |
name | Ülkenin adını vermektedir. | string |
phoneCode | Ülkenin telefon kodunu vermektedir. | int |
timeZone | Ülkenin timezone değerini vermektedir. | string |
Ülkelerin Şehirlerini Listeleme - İstek
Buradaki işlemde yukarı yer alan "CountryID" bilgisini ilgili sayfaya göndermemiz gerekmektedir.
İstek |
---|
GET - https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223 |
Alan | Veri Tipi | Zorunluluk | Açıklama |
---|---|---|---|
country_id | Ülke ID'sini göndermeniz gerekmektedir. | string |
Zorunlu |
Örnek Kodlar |
---|
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location --request GET 'https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223' \
--header 'Authorization: Bearer API_KEY'
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223");
xhr.setRequestHeader("Authorization", "Bearer API_KEY");
xhr.send();
var client = new RestClient("https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer API_KEY");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.get("https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223")
.header("Authorization", "Bearer API_KEY")
.asString();
import http.client
conn = http.client.HTTPSConnection("www.nosyapi.com")
payload = ''
headers = {
'Authorization': 'Bearer API_KEY'
}
conn.request("GET", "/apiv2/countries/getStateList?country_id=223", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://www.nosyapi.com/apiv2/countries/getStateList?country_id=223")!,timeoutInterval: Double.infinity)
request.addValue("Bearer API_KEY", forHTTPHeaderField: "Authorization")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Diğer programlama dilleri ve postman dosyası lütfen info@nosyapi.com adresine mail atınız.
Not: API_TOKEN yazan yerleri kendi token bilginizle değiştirmeyi unutmayınız.
Yanıt |
---|
{
{
"status": "ok",
"systemTime": 1607171234,
"message": "ok",
"rowCount": 81,
"data": [
{
"name": "Adana"
},
{
"name": "Adiyaman"
},
{
"name": "Afyon"
},
]
}
Alan | Açıklama | Veri Tipi |
---|---|---|
name | Şehirlerin adını vermektedir. | string |
Etiketler: ülke timezone api, ülke telefon kodları api, country timezone api,country phone code,country states api,ülke şehir api