Ülke Şehir Listele

Ülke Şehir Listele

Bu API, belirli bir ülkenin şehirlerini listelemesini sağlar.

Endpoint Bilgileri

  • URL: {{APP_URL}}/api/v1/countries/{country_id}/states
  • HTTP Metodu: GET
  • İçerik Türü: application/json
  • Kimlik Doğrulama Tipi: APIKEY

İstek Parametreleri

URL Parametreleri

Parametre Adı Parametre Tipi Zorunluluk Açıklama
country_id Integer Zorunlu Ülke ID'si

Örnek Kullanım

API İsteği

Aşağıda, API isteği için bir örnek HTTP raw request bulunmaktadır.

GET {{APP_URL}}/api/v1/countries/1/states
Content-Type: application/json
APIKEY: {{APIKEY}}

API Cevabı

Başarılı bir istekte, API aşağıdaki gibi bir yanıt döndürecektir:

{
    "status": true,
    "message": null,
    "data": [
        {
            "id": 1,
            "name": "Badakhshan",
            "stateCode": "BDS"
        },
        {
            "id": 2,
            "name": "Badghis",
            "stateCode": "BDG"
        },
        {
            "id": 3,
            "name": "Baghlan",
            "stateCode": "BGL"
        },
        {
            "id": 4,
            "name": "Balkh",
            "stateCode": "BAL"
        },
        {
            "id": 5,
            "name": "Bamyan",
            "stateCode": "BAM"
        }
    ]
}

Hata Cevapları

API isteği başarısız olursa, API aşağıdaki gibi bir hata yanıtı döndürecektir:

{
    "status": false,
    "errors": [
        {
            "message": "Country not found"
        }
    ]
}