I am having difficulties using the REST API connector in Camunda 8. I am trying to connect to the Azure Document Intelligence API to use an OCR processing feature. While the same request is successful in Postman, in Camunda I get the error message “Error during json mapping.”
Here are the details of my configuration:
Authentication:
Type: API Key
Key Location: Header
Key Name: Ocp-Apim-Subscription-Key
Key Value: [The API key] (The key is correct and works in Postman.)
HTTP Endpoint:
Method: POST
URL: https://[my-endpoint].cognitiveservices.azure.com/formrecognizer/documentModels/prebuilt-receipt:analyse?api-version=2023-07-31
Header: Content-Type: application/json
Payload:
Body: { “urlSource”: “https://[my-blob].blob.core.windows.net/invoices/invoice_kfz.png” }
The problem seems to be with the processing of the JSON response from Azure. I have checked the output mapping section in Camunda and I am sure I am mapping the results correctly. The same JSON works fine in Postman. Has anyone had similar experiences or can provide troubleshooting advice?
Any help or suggestions would be greatly appreciated!
Hi @nathan.loding, thanks for your asstiance. I’m pretty new to the Camunda/ API world. Can you maybe just give me a bit more context on what exactly I need to do or where I need to look? Thanks again!
@kebru09 - do you have output mappings defined for this Connector? If you’re getting an empty body back, but trying to parse the body in the output mappings, I wonder if that’s perhaps causing the issue?
@kebru09 - the resultID at the beginning is probably going to be a null/undefined object. You probably want something like { resultId: response.headers.Operation-Location } (demo)
@nathan.loding still got the problem. I don’t find any documentation about the response from the azure document intelligence JSON format to see the JSON format for POST.
hi @onkarsghotra, you are awsome! I tried with no authentication and put the API key in the header and now it is working!
I also get a JSON back but now I have a problem with “-” in the FEEEL expression. I get also the time a null back when I go into { resultId: response.headers.Operation-Location }. For example the { resultId: response.headers.Date } is working…
Hi @kebru09 - I haven’t tested, but you can try using the get value() built-in function (docs): { resultId: get value(response.headers, "Operation-Location") }