A) Validation of Update API
The validation is as same as Create API.
B) Update scenario
- Update with direct approach
- Update through approval process
- Unable to update non update-able field
C) Sample Request & Response
Update with direct approach
Patient detail e.g Primary contact, Disability, Place of Birth etc can be updated directly.
- curl -XPUT /api/v1/patients/5963462863791063041 -d"
{
"primary_contact" : "Ms. Jennifer",
"place_of_birth" : "Dhaka"
}
Response-
Status - 202 (Accepted)
Location- http://192.168.1.68:8081/api/v1/patients/5963462863791063041
{
"hid" : "5963462863791063041"
"nid" : "19908767898768909",
"given_name" : "Alisha Tamrin",
"sur_name" : "Diva",
"gender" : "F",
"date_of_birth" : "1990-01-10",
"primary_contact" : "Ms. Jennifer",
"place_of_birth" : "Dhaka",
"present_address" : {
"address_line" : "Dhaka",
"division_id" : "60",
"district_id" : "36",
"upazila_id" : "02",
"post_office" : "Banani",
"post_code" : "1200",
"country_code" : "050"
}
}
2. Update through approval process
Patient detail e.g Given name,Gender,Occupation,Status,Present address and Phone number must be updated through approval process.
First, the request goes to pending approval list of approver. Then, concerned approver under catchment either 'ACCEPT' / 'REJECT' the request.
If the request gets approved, MCI will save the updated value and if the request gets rejected, MCI will keep previous value.
- curl -XPUT /api/v1/patients/5963462863791063041 -d"
{
"given_name" : " Diya Tamrin"
}
Response-
Status - 202 (Accepted)
Location- http://192.168.1.68:8081/api/v1/patients/5963462863791063041
{
"nid" : "19908767898768909",
"given_name" : "Alisha Tamrin",
"sur_name" : "Diva",
"gender" : "F",
"date_of_birth" : "1990-01-10",
"primary_contact" : "Ms. Jennifer",
"place_of_birth" : "Dhaka",
"present_address" : {
"address_line" : "Dhaka",
"division_id" : "60",
"district_id" : "36",
"upazila_id" : "02",
"post_office" : "Banani",
"post_code" : "1200",
"country_code" : "050"
}
}
- ACCEPT Update Request by Concerned Approver-
curl -XPUT /api/v1/patients/pendingapprovals/5963462863791063041 -d"
{
"given_name" : " Diya Tamrin"
}
Response-
Status - 202 (Accepted)
Location- http://192.168.1.68:8081/api/v1/patients/5963462863791063041
{
"hid" : "5963462863791063041"
"nid" : "19908767898768909",
"given_name" : "Diya Tamrin",
"sur_name" : "Diva",
"gender" : "F",
"date_of_birth" : "1990-01-10",
"primary_contact" : "Ms. Jennifer",
"place_of_birth" : "Dhaka",
"present_address" : {
"address_line" : "Dhaka",
"division_id" : "60",
"district_id" : "36",
"upazila_id" : "02",
"post_office" : "Banani",
"post_code" : "1200",
"country_code" : "050"
}
}
- REJECT Update Request by Concerned Approver-
curl -XPUT /api/v1/patients/pendingapprovals/5963462863791063041 -d"
{
"given_name" : " Diya Tamrin"
}
Response-
Status - 202 (Accepted)
Location- http://192.168.1.68:8081/api/v1/patients/5963462863791063041
{
"hid" : "5963462863791063041"
"nid" : "19908767898768909",
"given_name" : "Alisha Tamrin",
"sur_name" : "Diva",
"gender" : "F",
"date_of_birth" : "1990-01-10",
"primary_contact" : "Ms. Jennifer",
"place_of_birth" : "Dhaka",
"present_address" : {
"address_line" : "Dhaka",
"division_id" : "60",
"district_id" : "36",
"upazila_id" : "02",
"post_office" : "Banani",
"post_code" : "1200",
"country_code" : "050"
}
}
3. Unable to update non update-able filed
Patient detail e.g Date of Birth cannot be updated as it is defined as non update-able field.
- curl -XPUT /api/v1/patients/5963462863791063041 -d"
{
"date_of_birth" : "2000-09-09"
}