Continent

Dokumentasi ini menjelaskan cara mengakses layanan API GoTravelly untuk method Continent.

API berfungsi untuk mendapatkan, menambahkan, mengubah, dan menghapus data Benua di GoTravelly.

Method & URL

Method URL
GET, POST, PUT, DELETE https://www.gotravelly.com/api/continent

Request & Response


GET (Request)

Method Parameter Tipe Wajib Keterangan
GET/HEADER key String Tidak Token code / key
GET/PARAM id String Tidak ID Benua
GET/PARAM fields String Tidak Atribut yang ingin didapat (atribut yang tersedia : id, name)
GET/PARAM sorts String Tidak Atribut yang ingin diurutkan (atribut yang tersedia : id atau name)
GET/PARAM sort_type String Tidak Jenis pengurutan yang diinginkan (nilai : ASC atau DESC)
GET/PARAM per_page Integer Ya Jumlah tampilan history balance di per halaman
GET/PARAM page Integer Tidak Halaman / offset data yang ditampilkan (biasanya digenerate otomatis)

Contoh GET (Request):

  • untuk mendapatkan semua data benua
  • https://suksesselalu.gotravelly.com/api/continent?per_page=1&page=1
  • untuk mendapatkan detail benua
  • https://suksesselalu.gotravelly.com/api/continent?id=2


    GET (Response)


    Success Response (200)
    [
        {
            "id": "2",
            "name": "Africa"
        }
    ]
    

    Failed Response (404)
    {
        "status": "ERROR",
        "message": "Continent could not be found"
    }
    

    POST (Request)

    Method Parameter Tipe Wajib Keterangan
    POST/HEADER key String Ya Token code / key
    POST/BODY name String Ya Nama Benua

    POST (Response)


    Success Response (201)
    {
        "name": "AA"
    }
    

    Failed Response (409)
    {
        "status": "CONFLICT",
        "message": "Duplicate continent name"
    }
    

    Failed Response (400)
    {
        "status": "FAILED",
        "message": {
            "name": "<p>The continent name field is required.</p>"
        }
    }
    

    Atau

    {
        "status": "FAILED",
        "message": {error_message}
    }
    

    PUT (Request)

    Method Parameter Tipe Wajib Keterangan
    PUT/HEADER key String Ya Token code / key
    PUT/BODY id Integer Ya ID Benua yang akan diubah
    PUT/BODY name String Ya Nama Benua

    PUT (Response)


    Success Response (200)
    {
        "name": "AAAA"
    }
    

    Failed Response (409)
    {
        "status": "CONFLICT",
        "message": "Duplicate continent name"
    }
    

    Failed Response (400)
    {
        "status": "FAILED",
        "message": {
            "id": "<p>The continent id field is required.</p>",
            "name": "<p>The continent name field is required.</p>"
        }
    }
    

    Atau

    {
        "status": "FAILED",
        "message": Failed to update continent."
    }
    

    Atau

    {
        "status": "FAILED",
        "message": {error_message}
    }
    

    DELETE (Request)

    Method Parameter Tipe Wajib Keterangan
    DELETE/HEADER key String Ya Token code / key
    DELETE/BODY id String Ya ID Benua yang akan dihapus

    DELETE (Response)


    Success Response (200)
    {
        "status": SUCCESS",
        "message": ""
    }
    

    Failed Response (400)
    {
        "status": "FAILED",
        "message": "Continent ID is required"
    }