Skip to content

Instantly share code, notes, and snippets.

@roniemicro
Last active August 29, 2015 14:02
Show Gist options
  • Save roniemicro/f9c0ea2e951f98f73263 to your computer and use it in GitHub Desktop.
Save roniemicro/f9c0ea2e951f98f73263 to your computer and use it in GitHub Desktop.
MCI APIs (19 June 2014)
Create API: /patient (POST)
Input JSON (all fields):
{
"nid" : 123456,
"first_name" : "Roni",
"middle_name" : "Kumar",
"last_name" : "qwe",
"date_of_birth" : "1983-09-21",
"gender" : "1",
"present_address" : {
"address_line" : "xyz",
"division_id" : 10,
"district_id":10,
"union_id":10,
"upazilla_id":10
}
}
Input JSON (only mandatory fields):
{
"first_name" : "Roni",
"last_name" : "qwe",
"date_of_birth" : "1983-09-21",
"gender" : "2",
"present_address" : {
"address_line" : "xyz",
"division_id" : 10,
"district_id":10,
"union_id":10,
"upazilla_id":10
}
}
If non-empty hid is passed, the same hid is returned in the response.
Constraints:
first_name: not empty //todo: min, max
last_name: not empty //todo: min, max
date_of_birth: = not empty, Date format: yyyy-MM-dd
gender: 1, 2, or 3
present_address:
address_line: not empty, min = 3, max = 20
division_id: any 2 to 10 digits no
district_id: any 2 to 10 digits no
union_id: any 2 to 10 digits no
upazilla_id: any 2 to 10 digits no
Response:
Success: response code: 201, response: healthid
Errors:
Validation errors: response code: 400, response: {code: 400, message: "invalid.request"}
All other errors: response code: 500, response: {code: 500, message: "internal.server.error"}
------------------------
Find by health id API: /patient/<hid> (GET)
Response:
Success: response code: 200, response: <patient json>
Errors:
Not found: response code: 404, response: {code: 404, message: "patient.not.found"}
All other errors: response code: 500, response: {code: 500, message: "internal.server.error"}
------------------------
Find by national id API: /patient?nid=<nid> (GET)
Response:
Success: response code: 200, response: <patient json>
Errors:
Not found: response code: 404, response: {code: 404, message: "patient.not.found"}
All other errors: response code: 500, response: {code: 500, message: "internal.server.error"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment