简体   繁体   中英

Azure FHIR: Error when creating a Media Resource

I want to create a Media resource in my Azure FHIR, I follow the standard definition on https://www.hl7.org/fhir/media.html (In summary, there are only 2 mandatory fields: status and Content) but It did not work!.

I try the simplest possible example: { "resourceType": "Media", "id": "", "status": "unknown", "content": { "id": "a1", "contentType": "audio/mpeg", "data": "" } }

But Server shows an error: "Type checking the data: Encountered unknown element 'status' at location 'Resource.status[0]' while parsing"

When remove the status field, the server shows a different error: "Element with min. cardinality 1 cannot be null".

Can anybody tell me what is the correct syntax for creating a Media Resource?

Thanks

I have just attempted to reproduce that but I cannot. When I do a

POST https://<myservice>.azurehealthcareapis.com/Media

With a payload of:

{ "resourceType": "Media", "id": "", "status": "unknown", "content": { "id": "a1", "contentType": "audio/mpeg", "data": "" } }

I get 201 CREATED and return payload of:

{
    "resourceType": "Media",
    "id": "7140a11a-dc59-4766-83f9-027a56d69551",
    "meta": {
        "versionId": "1",
        "lastUpdated": "2019-12-26T07:10:46.993+00:00"
    },
    "status": "unknown",
    "content": {
        "id": "a1",
        "contentType": "audio/mpeg"
    }
}

Could it be that your instance of the Azure API for FHIR is STU3, but you are using an R4 Media resource. I believe the "status" element was added in R4.

Thanks Michael! I mixed up STU3 and R4.

Followed correct version of Media: https://www.hl7.org/fhir/STU3/media.html , and it was solved!

{ "resourceType": "Media", "id": "d5af5eb3-1402-4249-987e-8ff1c09384b1", "meta": { "versionId": "1", "lastUpdated": "2019-12-27T03:41:16.288+00:00" }, "type": "photo", "content": { "id": "a1", "contentType": "audio/mpeg" } }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM