Genel Bakış
NosyAPI Ülke ve Şehir Saatleri(Tarih) API dökümantasyonuna hoşgeldiniz.
Bu dökümantasyonu ile dünyada yer alan 246 ülke ve bunlar içerisinde yer alan 461 adet önemli şehrin tarih ve saat bilgisine ulaşabilirsiniz.
İçindekiler
- API Token Bilgileri
- Ülkeleri ve Şehirlerin Saatlerini Öğrenme - İstek
- Ülkeleri ve Şehirlerin Saatlerini Öğrenme - Ö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 ve Şehirlerin Saatlerini Öğrenme - İstek
İstek |
---|
GET - https://www.nosyapi.com/apiv2/countries/getTime?name=paris |
name yerine gelecek ülke ve şehir isimlerini aşağıdaki endpointlerden öğrenebilirsiniz. Bu endpointlerin kullanımı ücretsizdir. |
GET - https://www.nosyapi.com/apiv2/countries/getTimeCountry (Ülke isimlerini listeler. Slug değerlerini "name" kısmına girebilirsiniz.) |
GET - https://www.nosyapi.com/apiv2/countries/getTimeState (Şehir isimlerini listeler. Slug değerlerini "name" kısmına girebilirsiniz.) |
Örnek Kodlar |
---|
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.nosyapi.com/apiv2/countries/getTime?name=paris',
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/getTime?name=paris' \
--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/getTime?name=paris");
xhr.setRequestHeader("Authorization", "Bearer API_KEY");
xhr.send();
var client = new RestClient("https://www.nosyapi.com/apiv2/countries/getTime?name=paris");
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/getTime?name=paris")
.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/getTime?name=paris", 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/getTime?name=paris")!,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": "success",
"message": "ok",
"systemTime": 1608511084,
"rowCount": 4,
"data": {
"date": "2020-12-21",
"datetime": "2020-12-21 01:38:04",
"time": "01:38",
"timeDetails": "01:38:04"
}
}
Alan | Açıklama | Veri Tipi |
---|---|---|
date | Tarih bilgisini verir. | date |
datetime | Tarih ve saat bilgisini döndürür. | datetime |
time | Saat bilgisini verir. | time |
phoneCode | Saat bilgisini saat,dakika ve salise olarak verir. | time |