Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Last active February 13, 2019 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/ff27e58fae538e86bf25d577cb7319b1 to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/ff27e58fae538e86bf25d577cb7319b1 to your computer and use it in GitHub Desktop.
(Medium) - Evolvable APIs
// Response for:
// GET /start-booking
{
"data": [{
"type": "action",
"id": "required-fields",
"attributes": {
"url": "/start-booking",
"method": "post",
"fields": [{
"type": "text",
"name": "username",
"read-only": false,
"value": ""
}, {
"type": "text",
"name": "intendedDoctor",
"read-only": false,
"value": ""
}]
}
}]
}
// Response for:
// POST /start-booking
// With request body:
// { "username": "mary.doe", "intendedDoctor": "jane" }
{
"data": [{
"type": "action",
"id": "required-fields",
"attributes": {
"url": "/start-booking",
"method": "post",
"fields": [{
"type": "text",
"name": "username",
"read-only": true,
"value": "mary.doe"
}, {
"type": "text",
"name": "intendedDoctor",
"read-only": true,
"value": "jane"
}, {
"type": "select",
"name": "available-time-slots",
"read-only": false,
"value": "",
"options": [
{ "value": "2018-05-01T10:00:00" },
{ "value": "2018-05-01T10:15:00" },
{ "value": "2018-05-01T10:30:00" }
]
}, {
"type": "text",
"name": "booking",
"read-only": false,
"value": ""
}]
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment