Getting Started

Star Fork

Malaysia Prayer Times (Waktu Solat) JSON API. Data is from JAKIM’s E-Solat.

An brief introduction:

  • Built with Ruby (2.3.1) on Rails (5.0.1)
  • Deployed on Heroku on midnight of 01 February 2017
  • Data updates every midnight

Status Codes

Code Name Description
200 OK Success
400 Bad Request Request may contain insufficient or unpermitted parameters

Error Messages

Error Description
unpermitted parameters Request contains unpermitted parameters
[PARAMETER] parameter value is empty Request contains permitted parameters that are empty

All errors will return JSON in the following format:

{
  "error": "error message here"
}

/states

List all states

Endpoint

https://waktu-solat-api.herokuapp.com/api/v1/states.json

Parameters
negeri (optional)
filter state by its name and list its zones
Examples
curl https://waktu-solat-api.herokuapp.com/api/v1/states.json
curl https://waktu-solat-api.herokuapp.com/api/v1/states.json?negeri=STATE_NAME

Example Response

{
  "data": {
    "negeri": [
      "labuan",
      "terengganu",
      "sarawak",
      "putrajaya",
      "kuala lumpur",
      "selangor",
      "sabah",
      "perak",
      "pulau pinang",
      "perlis",
      "pahang",
      "negeri sembilan",
      "melaka",
      "kelantan",
      "kedah",
      "johor"
    ]
  }
}
{
  "data": {
    "negeri": {
    "nama": "selangor",
    "zon": [
        "sabak bernam",
        "kuala selangor",
        "klang",
        "kuala langat",
        "gombak",
        "h. selangor",
        "rawang",
        "h. langat",
        "sepang",
        "petaling",
        "s. alam"
      ]
    }
  }
}

/zones

List all zones

Endpoint

https://waktu-solat-api.herokuapp.com/api/v1/zones.json

Parameters
zon (optional)
filter zone by its name and get its corresponding state
Examples
curl https://waktu-solat-api.herokuapp.com/api/v1/zones.json
curl https://waktu-solat-api.herokuapp.com/api/v1/zones.json?zon=ZONE_NAME

Example Response

{
  "data": {
    "zon": [
      "lumut",
      "labuan",
      "kemaman dungun",
      "hulu terengganu",
      "besut",
      "setiu",
      "kuala terengganu",
      "marang",
      ...,
      "mersing",
      "johor bahru",
      "pulau aur",
      "pemanggil"
    ]
  }
}
{
  "data": {
    "negeri": "selangor",
    "zon": "sepang"
  }
}

/prayer_times

List all prayer times

Endpoint

https://waktu-solat-api.herokuapp.com/api/v1/prayer_times.json

Parameters
negeri (optional)
list prayer times by state
zon (optional)
list prayer times by zone
Examples
curl https://waktu-solat-api.herokuapp.com/api/v1/prayer_times.json
curl https://waktu-solat-api.herokuapp.com/api/v1/prayer_times.json?negeri=STATE_NAME
curl https://waktu-solat-api.herokuapp.com/api/v1/prayer_times.json?zon=ZONE_NAME
curl https://waktu-solat-api.herokuapp.com/api/v1/prayer_times.json?negeri=STATE_NAME&zon=ZONE_NAME

Example Response

{
  "data": {
    "negeri": [
      {
        "nama": "labuan",
        "zon": [
          {
            "nama": "labuan",
            "waktu_solat": [
              {
                "name": "imsak",
                "time": "05:06"
              },
              ...,
              {
                "name": "isyak",
                "time": "19:42"
              }
            ]
          }
        ]
      },
      ...,
      {
        "nama": "johor",
        "zon": [
          ...,
          {
            "nama": "pemanggil",
            "waktu_solat": [
              {
                "name": "imsak",
                "time": "05:46"
              },
              ...,
              {
                "name": "isyak",
                "time": "20:29"
              }
            ]
          }
        ]
      }
    ]
  }
}
{
  "data": {
    "negeri": "selangor",
    "zon": [
      {
        "nama": "sabak bernam",
        "waktu_solat": [
          {
            "name": "imsak",
            "time": "06:01"
          },
          ...,
          {
            "name": "isyak",
            "time": "20:41"
          }
        ]
      },
      ...,
      {
        "nama": "s. alam",
        "waktu_solat": [
          {
            "name": "imsak",
            "time": "05:59"
          },
          ...,
          {
            "name": "isyak",
            "time": "20:39"
          }
        ]
      }
    ]
  }
}
{
  "data": [
    {
      "negeri": "selangor",
      "zon": "sepang",
      "waktu_solat": [
        {
          "name": "imsak",
          "time": "05:59"
        },
        {
          "name": "subuh",
          "time": "06:09"
        },
        {
          "name": "syuruk",
          "time": "07:26"
        },
        {
          "name": "zohor",
          "time": "13:29"
        },
        {
          "name": "asar",
          "time": "16:51"
        },
        {
          "name": "maghrib",
          "time": "19:27"
        },
        {
          "name": "isyak",
          "time": "20:39"
        }
      ]
    }
  ]
}
{
  "data": {
    "negeri": "selangor",
    "zon": [
      {
        "nama": "sepang",
        "waktu_solat": [
          {
            "name": "imsak",
            "time": "05:59"
          },
          {
            "name": "subuh",
            "time": "06:09"
          },
          {
            "name": "syuruk",
            "time": "07:26"
          },
          {
            "name": "zohor",
            "time": "13:29"
          },
          {
            "name": "asar",
            "time": "16:51"
          },
          {
            "name": "maghrib",
            "time": "19:27"
          },
          {
            "name": "isyak",
            "time": "20:39"
          }
        ]
      }
    ]
  }
}