Diğer API methodlarını kullanmadan önce, API'ya istek gönderirken yanıtların istediğiniz içerik dilinde gönderilebilimesi için ihtiyacınız olan dil verilerini döndürür.
| API URL | Method | Response |
|---|---|---|
| /api/languages | GET | application/json |
<?php
header('Content-type: application/json');
$apiUri = "http://siteadresiniz.com/api/languages";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUri);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
exit(curl_exec($ch));
?>
[
{
"id": 1,
"title": "Türkçe",
"lang_code": "tr_TR"
}
]
Girilen dil ID'sine ait çeviri metinlerini getirir.
| API URL | Method | Response |
|---|---|---|
| /api/languages/get/{$id} | GET | JSON |
Parametreler
| Parametre | Açıklama | Tür | Zorunlu |
|---|---|---|---|
| id | Çevirileri istenen dile ait id. | Int | Evet |
<?php
header('Content-type: application/json');
$id = 1;
$apiUri = "http://siteadresiniz.com/api/languages/get/{$id}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUri);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
exit(curl_exec($ch));
?>
{
"favourites": "Favorilerim",
"my_account": "Hesabım",
"my_orders": "Siparişlerim",
"my_profile": "Profilim",
"logout": "Çıkış Yap",
"signup": "Kayıt Ol",
"login": "Giriş Yap",
....
}
Geçersiz ID girdiğinizde boş array dönmektedir.