Open nir-r opened 1 month ago
Did you try "data" instead of "body"? Is the issue still relevant?
Did you try "data" instead of "body"? Is the issue still relevant?
Using il-fhir-certificator@1.1.0
With an updated map
(
/*1) Params*/
$resourceType := 'Observation'
;$baseUrl := $search($resourceType).link[0].url~>$substringBefore('/'&$resourceType)
/*Create meta security labels*/
;$meta_security := (
{
"security" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code" : "R",
"display" : "restricted"
}
,{
"system" : "http://fhir.health.gov.il/cs/Information-Bins",
"code" : "x",
"display" : "Bin X"
}
]
}
)
/*2) Extract instances and add the security lables*/
;$updates := $search($resourceType,{'_count':3}).entry.resource ~> |meta|$meta_security|
/*Create update bundle*/
;$bundle := (
Instance: $uuid()
InstanceOf: Bundle
* type = 'transaction'
* ($updates).entry
* request
* method = 'PUT'
* url = $resourceType & '/' & $.id
* resource = $
)
/*3) Psot created bundle back to server*/
;$http({
'method' : 'POST'
,'baseUrl': $baseUrl
,'url': $resourceType
,'timeout' : 30000
,'headers' : {'Content-Type': 'application/fhir+json'}
,'data': $string($bundle)
})
)
Im getting
{
"status": 400,
"statusText": "",
"headers": {
"date": "Tue, 13 Aug 2024 06:02:14 GMT",
"content-type": "application/fhir+json;charset=UTF-8",
"transfer-encoding": "chunked",
"connection": "keep-alive",
"server": "Apache/2.4.46 (Amazon) OpenSSL/1.0.2k-fips",
"x-powered-by": "HAPI FHIR 5.4.1 REST Server (FHIR Server; FHIR 4.0.1/R4)",
"x-request-id": "Y48G5cnjiQMDttgq"
},
"data": {
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Incorrect Content-Type header value of "application/x-www-form-urlencoded" was provided in the request. A FHIR Content-Type is required for "CREATE" operation</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Incorrect Content-Type header value of \"application/x-www-form-urlencoded\" was provided in the request. A FHIR Content-Type is required for \"CREATE\" operation"
}
]
}
}
Configuration is (.env)
SERVER_STATELESS=false
FHIR_SERVER_BASE=http://hapi-fhir.outburn.co.il/fhir
# http://ec2-3-124-79-139.eu-central-1.compute.amazonaws.com:52773/csp/healthshare/rambam/fhir/r4
# https://server.fire.ly/r4
# http://hapi.fhir.org/baseR4
# https://demo.kodjin.com
FHIR_SERVER_AUTH_TYPE=NONE
FHIR_SERVER_UN=FUME_BasicAuth
FHIR_SERVER_PW=fumeauth
# CANONICAL_BASE_URL=http://localdev.fume.health
SKIP_FLASH_TEMPLATE=false
FHIR_VERSION=4.0.1
FHIR_PACKAGES=il.core.fhir.r4,hl7.fhir.us.core,rambam-fhir.health.gov.il,leumit.fhir.r4
SERVER_PORT=42420
FHIR_SERVER_TIMEOUT=50000
# The maximum number of resources to return in a single page lookup
SEARCH_BUNDLE_PAGE_SIZE=30
Did you try without the $string(), passing the regular json in 'data'?
Getting different errors (see below) for the same map (see below) used on different servers.
Fume map
Error on http://hapi-fhir.outburn.co.il/fhir
Error on http://ec2-3-124-79-139.eu-central-1.compute.amazonaws.com:52773/csp/healthshare/rambam/fhir/r4