Skip to content

Appointments

Vadim Sokoltsov edited this page Apr 19, 2017 · 1 revision

POST /api/v1/appointments

Creates new appointment for direction

Request parameters

  • direction_id - type: integer - direction's id - REQUIRED
  • date - type: datetime (with timezone) - appointment's date - REQUIRED
  • repeats - type: string - flag for appointment scheduling - REQUIRED
  • message - type: string - text for appointment
  • available - type: boolean - flag for appointment's availability

Response parameters

  • direction - type: json - direction's object
  • date - type: datetime (with timezone) - appointment's date
  • repeats - type: string - flag for appointment scheduling
  • message - type: string - text for appointment
  • available - type: boolean - flag for appointment's availability
  • created_at - type: datetime (with timezone) - appointment's date of creation

Errors

  • direction_id - Can't be blank
  • date - Can't be blank, Cannot be in the past
  • repeats - Can't be blank

Request example

POST /api/v1/appointments HTTP/1.1
Host: dockerhost:3000
Content-Type: application/json
uprogresstoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MX0.DeefNqb69orzcJu8RIq9ClD4ZPTOF1R6yC1ABiBB6BY
Cache-Control: no-cache

{
	"appointment": {
		"date": "2017-04-21 12:00:00",
		"direction_id": "315",
		"repeats": "every_day"
	}
}

Success response example

{
  "appointment": {
    "id": 15,
    "message": null,
    "date": "2017-04-21T12:00:00.000Z",
    "created_at": "2017-04-19T22:42:27.741Z",
    "repeats": "every_day",
    "available": null,
    "direction": {
      "id": 315,
      "title": "Sonsing",
      "description": "Try to quantify the HDD microchip, maybe it will compress the back-end transmitter!",
      "finished_steps_count": 2,
      "percents_result": 40,
      "updated_at": "2017-04-10T10:45:14.264Z",
      "slug": "zathin"
    }
  }
}

Failed response example

{
  "errors": {
    "direction_id": [
      "can't be blank"
    ],
    "date": [
      "can't be blank"
    ],
    "repeats": [
      "can't be blank"
    ]
  }
}

PUT /api/v1/appointments/:id

Updates existent appointment

Request parameters

  • direction_id - type: integer - direction's id - REQUIRED
  • date - type: datetime (with timezone) - appointment's date - REQUIRED
  • repeats - type: string - flag for appointment scheduling - REQUIRED
  • message - type: string - text for appointment
  • available - type: boolean - flag for appointment's availability

Response parameters

  • direction - type: json - direction's object
  • date - type: datetime (with timezone) - appointment's date
  • repeats - type: string - flag for appointment scheduling
  • message - type: string - text for appointment
  • available - type: boolean - flag for appointment's availability
  • created_at - type: datetime (with timezone) - appointment's date of creation

Errors

  • direction_id - Can't be blank
  • date - Can't be blank, Cannot be in the past
  • repeats - Can't be blank

Request example

POST /api/v1/appointments/15 HTTP/1.1
Host: dockerhost:3000
Content-Type: application/json
uprogresstoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MX0.DeefNqb69orzcJu8RIq9ClD4ZPTOF1R6yC1ABiBB6BY
Cache-Control: no-cache

{
	"appointment": {
		"date": "2017-04-21 12:00:00",
		"direction_id": "315",
		"repeats": "every_day"
	}
}

Success response example

{
  "appointment": {
    "id": 15,
    "message": null,
    "date": "2017-04-21T12:00:00.000Z",
    "created_at": "2017-04-19T22:42:27.741Z",
    "repeats": "every_day",
    "available": null,
    "direction": {
      "id": 315,
      "title": "Sonsing",
      "description": "Try to quantify the HDD microchip, maybe it will compress the back-end transmitter!",
      "finished_steps_count": 2,
      "percents_result": 40,
      "updated_at": "2017-04-10T10:45:14.264Z",
      "slug": "zathin"
    }
  }
}

Failed response example

{
  "errors": {
    "direction_id": [
      "can't be blank"
    ],
    "date": [
      "can't be blank"
    ],
    "repeats": [
      "can't be blank"
    ]
  }
}

DELETE /api/v1/appointments/:id

Deletes appointment

Request example

DELETE /api/v1/appointments/15 HTTP/1.1
Host: dockerhost:3000
Content-Type: application/json
uprogresstoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MX0.DeefNqb69orzcJu8RIq9ClD4ZPTOF1R6yC1ABiBB6BY
Cache-Control: no-cache

Response example

{
  "appointment": {
    "id": 15,
    "message": null,
    "date": "2017-04-21T12:00:00.000Z",
    "created_at": "2017-04-19T22:42:27.741Z",
    "repeats": "every_day",
    "available": null,
    "direction": {
      "id": 315,
      "title": "Sonsing",
      "description": "Try to quantify the HDD microchip, maybe it will compress the back-end transmitter!",
      "finished_steps_count": 2,
      "percents_result": 40,
      "updated_at": "2017-04-10T10:45:14.264Z",
      "slug": "zathin"
    }
  }
}

Clone this wiki locally