Problems with the REST API Connector in Camunda 8

Hello Camunda Community,

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!

Many thanks in advance!

Are you able to share the response that can’t be parsed?

Sure thing! Here is the error message.

image

Hi @kebru09 - that’s the incident in Operate; do you have a sample of the JSON returned from Azure that it cannot parse?

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!

When you test the API with Postman, what is the body of the response that you get back?

I only get back a header with keys. The body is empty. There is a link in the operation location value for the Get method.

@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?

@nathan.loding yes I tried to parse into the header of the the key Operation-Location
image
Is that correct?

@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.

I am getting the same error when using API key. When I don’t use the api key, there’s no error.

1 Like

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…

Do you have one more nice tip for me? :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

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") }