Suppose a new patient is trying to book an appointment using FHIR APIs , how should I get his/her first name, last name, dob, phone number in my system ?
The appointment resource just specifies actor reference which is an Id to Patient resource in this case. But I have not created the patient in system who is trying to book appointment first time. So I need all this patient details.
How can I post those details in Appointment resource which I post to create an appointment ?
Alternatively, if you do not wish to create the patient in your system yet until he/she shows up, the initial appointment could contain the Patient as a "contained resource": https://www.hl7.org/fhir/references.html#contained. This is useful for getting data across that doesn't have an identified endpoint on a FHIR server.
You should expect to perform multiple FHIR interactions:
You may also need to perform a Practitioner or other search prior to creating the patient if you want (for example) indicate who the patient's PCP is.