Anil patil
Anil patil

Reputation: 41

Post XML(fhir+xml) or JSON(fhir+json) to Web Api post Method (FHIR server hl7.fhir.stu3)

I am working on a medical application based on HL7 FHIR. I am trying to add new record using XML and JSON both. But all while posting XML I get is the '400 Bad Request'. The XML I am trying to POST is:

<Parameters xmlns="http://hl7.org/fhir"><parameter><name value="registerPatient" /><resource><Patient><meta><profile value="https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1" /></meta><identifier><extension url="https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-NHSNumberVerificationStatus-1"><valueCodeableConcept><coding><system value="https://fhir.nhs.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1" /><code value="01" /><display value="Number present and verified" /></coding></valueCodeableConcept></extension><system value="https://fhir.nhs.uk/Id/nhs-number" /><value value="9651258500" /></identifier><name><use value="official" /><family value="REA" /><given value="Clive" /></name><gender value="male" /><birthDate value="1951-10-03" /></Patient></resource></parameter></Parameters>

web api method post is:

 [HttpPost]
        [Route("Patient/$gpc.registerpatient")]
        [ApiResponseType(StatusCodes.Status200OK, typeof(Bundle))]
        [Consumes("application/fhir+xml")]
        [SwaggerOperation(Summary = "Register Patient")]
        public async Task<IActionResult> RegisterPatient([FromBody] Patient parameters)
        {

Upvotes: 0

Views: 142

Answers (0)

Related Questions