How to use Google Cloud Healthcare API HttpBody class?

I'm having a hard time using a method setData() of the HttpBody class. I'm passing the parameter to the method as an object, but I recieve an error message.

How do I pass the parameter:

public function create(string $resource, $body)
{

        $client   = $this->googleClient();
        $service  = new CloudHealthcare($client);

        $parent   = "projects/my_project_id/locations/my_location/datasets/my_dataset/fhirStores/repository";

        $httpBody = new HttpBody();
        $httpBody->setContentType('application/fhir+json;charset=utf-8');
        $httpBody->setData([
            "resourceType" => "Patient",
            "id" => "23434",
            "meta" => [
                "versionId" => "12",
                "lastUpdated" => "2014-08-18T15:43:30Z"
            ],
            "text" => [
                "status" => "generated",
                "div" => "<!-- Snipped for Brevity -->"
            ],
            "extension" => [
                [
                    "url" => "http://example.org/consent#trials",
                    "valueCode" => "renal"
                ]
            ],
            "identifier" => [
                [
                    "use" => "usual",
                    "label" => "MRN",
                    "system" => "http://www.goodhealth.org/identifiers/mrn",
                    "value" => "123456"
                ]
            ],
            "name" => [
                [
                    "family" => [
                        "Levin"
                    ],
                    "given" => [
                        "Henry"
                    ],
                    "suffix" => [
                        "The 7th"
                    ]
                ]
            ],
            "gender" => [
                "text" => "Male"
            ],
            "birthDate" => "1932-09-24",
            "active" => true
        ]);

        $data     = $service->projects_locations_datasets_fhirStores_fhir->create($parent, $resource, $httpBody);

        return $data;
}

Following the error message I get. The error says I didn't pass the resourceType field, but it was passed:

Google\Service\Exception: {
"issue": [
{
  "code": "structure",
  "details": {
    "text": "unparseable_resource"
  },
  "diagnostics": "missing required field \"resourceType\"",
  "expression": [
    ""
  ],
  "severity": "error"
}
],
 "resourceType": "OperationOutcome"
 } in file /usr/share/nginx/vendor/google/apiclient/src/Http/REST.php on line 128

How should I pass the parameter to receive the success message? Tkanks!

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum