API: Get All Routes

Request

Retrieve all routes with a GET request:

GET /routes

Available Query Parameters:

Parameter Type Description Example
page Integer Number of page (min: 1) 1
per_page Integer Number of items per page (max: 1000) 10
search String Start district name or End district name to search Example District

Sample Response:


{
  "status": "success",
  "code": 200,
  "message": "Routes retrieved successfully",
  "data": {
    "current_page": 1,
    "data": [
            {
                "id": 1,
                "start_name": "District 1",
                "end_name": "District 2",
                "distance": 1300,
                "duration": "02:45",
                "is_popular": "0",
                "popular_position": null,
                "status": "1"
            },
    ],
    "first_page_url": "http://127.0.0.1:8000/api/routes?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://127.0.0.1:8000/api/routes?page=1",
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "active": false
      },
      {
        "url": "http://127.0.0.1:8000/api/routes?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next »",
        "active": false
      }
    ],
    "next_page_url": null,
    "path": "http://127.0.0.1:8000/api/routes",
    "per_page": 10,
    "prev_page_url": null,
    "to": 1,
    "total": 1
  }
}