Skip to content

Latest commit

 

History

History
109 lines (90 loc) · 2.28 KB

APIDocs.md

File metadata and controls

109 lines (90 loc) · 2.28 KB

REST API SPECIFICATION

Get available dates

If the module is configured to load available dates from an API (see the docs), this method is called.

  • URL /availableDates

  • Method: GET

  • URL Params

    • No params
  • Success Response: Returns an array with available dates, a SUCCESS status and a message.
    IMPORTANT: Available dates should be in ISO 8601 format to work with an out of the box install of angular-reservation
    You can use status to return a 200 code response with an error and an optional message to explain what has happened.

    • Code: 200
      Content:
{
	"availableDates": [
	  "2017-11-24",
	  "2017-11-27"
	],
	"status": "SUCCESS",
	"message": ""
}

Get available hours for selected date

Called on date select, return the list of available hours for selected date.

  • URL /availableHours

  • Method: GET

  • URL Params

    • Required: selectedDate=[string]
  • Success Response: Returns an array with available hours for selected date, a SUCCESS status and a message.
    You can use status to return a 200 code response with an error and an optional message to explain what has happened.

    • Code: 200
      Content:
{
	"availableHours": [
	  "10:00",
	  "10.30",
	  "11.30",
	  "12.30",
	  "13.00",
	  "17.00",
	  "17.30",
	  "18.00",
	  "18.30",
	  "19.00"
	],
	"status": "SUCCESS",
	"message": ""
}

Reserve hour for selected date

Called on reserve action. Reserve selected hour from list of available hours for selected date passing user data.

  • URL /reserve

  • Method: POST

  • Data Params Include selected date, selected data and user data.

{
	"selectedDate": "2017-03-25",
	"selectedHour": "10:00",
	"userData": {
		"name": "Héctor",
		"phone": "123456789",
		"email": "[email protected]"
	}
}
  • Success Response: Returns a SUCCESS status and a message.
    You can use status to return a 200 code response with an error and an optional message to explain what has happened.

    • Code: 200
      Content:
{
  "status": "SUCCESS",
  "message": ""
}