Created 03-19-2018 11:09 AM
I am enriching my request payload with the payload attribute 'http.headers.orgId' and its working fine.
SPEC:
[{ "operation": "default",
"spec": {
"*": { "orgId": "${http.headers.orgId}" }
}
}]
INPUT :
{ "drivewiseDeviceData": { "imei": "sampleimei", "tripId": "3d9df81a-1828-40eb-940e-d2434eb5f50f", "sumVer": null, "payloadType": "Binary", "packetInfo": "", "payloadData": "g1bjSWX", "recordinfo": null, "sequenceNum": null, "timeStamp": "2017-05-26T12:07:29.968Z" } }
OUTPUT:
{ "drivewiseDeviceData": { "imei": "sampleimei", "tripId": "3d9df81a-1828-40eb-940e-d2434eb5f50f", "sumVer": null, "payloadType": "Binary", "packetInfo": "", "payloadData": "g1bjSWX", "recordinfo": null, "sequenceNum": null, "timeStamp": "2017-05-26T12:07:29.968Z", "orgId": "Sample Org Name Here" } }
.........................................................................................................................................
Now scenarios is I may get header attribute as 'http.headers.OrgID' or 'http.headers.orgId',
So is there any way to handle both scenarios in my JOLT spec?
If 'http.headers.orgId' value is null/empty/attribute-not-present then I should use 'http.headers.OrgID' for enrich.
Created 03-21-2018 01:36 PM
You should be able to use UpdateAttribute with ExpressionLanguage (probably the ifElse() function along with isNull()) in order to set http.headers.orgId to http.headers.OrgID if it is not already populated. Then you can keep the JOLT spec as-is.
Created 03-21-2018 01:36 PM
You should be able to use UpdateAttribute with ExpressionLanguage (probably the ifElse() function along with isNull()) in order to set http.headers.orgId to http.headers.OrgID if it is not already populated. Then you can keep the JOLT spec as-is.