Error parsing data from apiconnector2

I initialized an api call by manually entering the API response and I saved it. Yet when I make the call in a workflow, I’m receiving the error parsing data even though the api call is a success. I know this because a successful call emails me from the api endpoint. I know I have 2 options:

  1. to change the data type to text from JSON and then parse, but I’m not sure how I’d parse it with JavaScript.
  2. somehow fix the current way I’m doing it where the data type is json(obviously with someone helping me figure it out)

Either way I need help. The data I need from the call is the transid

Here is a response that I got from postman and used as the manually enter API response

{
“transactionResponse”: {
“responseCode”: “1”,
“authCode”: “”,
“avsResultCode”: “P”,
“cvvResultCode”: “”,
“cavvResultCode”: “”,
“transId”: “60116031728”,
“refTransID”: “”,
“transHash”: “97C3D8D66358E186F5CE21D6DCE0E0B3”,
“testRequest”: “0”,
“accountNumber”: “XXXX7890”,
“accountType”: “eCheck”,
“messages”: [
{
“code”: “1”,
“description”: “This transaction has been approved.”
}
],
“transHashSha2”: “”,
“SupplementalDataQualificationIndicator”: 0
},
“refId”: “00000010”,
“messages”: {
“resultCode”: “Ok”,
“message”: [
{
“code”: “I00001”,
“text”: “Successful.”
}
]
}
}

Screenshot of the error

1 Like

I’m having the same problem when posting to an API where the response is simply just a 200 status OK without any body in the reply. There are headers in the reply, just no body. The API post is successful and I know it works. I also Initialized the call normally, so I know that it works in the workflow, no errors.
It just seems that the API plugin doesn’t have a default way of handling API responses with zero body and a header…

Here’s the error message I get:
05%20AM

Is there a way to make this annoying error message disappear even tho the API call is successful.

2 Likes

Please email Support with a test call to see this behavior in API Connector when it is successful in Postman

So far I’m using return the data as text and then parsing it with regex. I’m struggling with regex though. I can arrive at the number I need after two separate operations, but I’d like to make it into one operation. This is the response string

{“transactionResponse”:{“responseCode”:“1”,“authCode”:"",“avsResultCode”:“P”,“cvvResultCode”:"",“cavvResultCode”:"",“transId”:“60116040358”,“refTransID”:"",“transHash”:“1C14D0053F4893C1B47CDFE7CD1D0FE1”,“testRequest”:“0”,“accountNumber”:“XXXX7890”,“accountType”:“eCheck”,“messages”:[{“code”:“1”,“description”:“This transaction has been approved.”}],“transHashSha2”:"",“SupplementalDataQualificationIndicator”:0},“refId”:“27”,“messages”:{“resultCode”:“Ok”,“message”:[{“code”:“I00001”,“text”:“Successful.”}]}}

The number I need is in bold. So far to get there, I’m using
Step 1 = transId":"\d*
which yields = transId":"60116040358
then
Step 2 = \d*
which yields the number I need.

I’m using regexr. I tried using the positive lookbehind (?<=transId":")\d* which worked on regex101.com, but not regexr. It’s not working in bubble either, so I figure regexr is what it should be based on.

If anyone can help me do it in one step, i’d appreciate it.

I’ve got the same error:

Error parsing data from apiconnector2

Can confirm it’s because there’s no body to the return. Personally, I’m using this to send messages to our company Slack channel (notifications), and it works but you get this error in Bubble. The only way I can get around it right now is to put it in an API workflow – the message goes through, it doesn’t break the frontend for our users, and even though the error still happens it doesn’t stop the user’s current workflow as it’s not being performed “in” their browser.

This is STILL a problem - Bubble needs to look into this. There should be a way to flag in the API connector that an empty body is expected to the API call. BTW, I’m also getting this error sending messages to a Slack channel. So we’re seeing the exact same issue.

1 Like

@josh4 and @cognilytica Please submit bug reports for your issues. API integrations require trial and error and if there is a limitation on our end, it is helpful for our engineering team to see it in an app

Turns out the problem was that the Slack API needed to be set as data type “text” and not data type “JSON”. And that should get rid of the random error message.

7 Likes

Thanks for mentioning this. It solved my problem.

Shokran, Thank you

This worked me!