API Connector call returns data when call is initialized, but when it's used seems to return empty data

This is going to be kind of a long one, so please bear with me.

I’ve defined an API call using the API Connector. When I initialize it, I see that data is returned. However, when I use it as a workflow action, it seems that no data is returned.

I am not seeing what I’m doing wrong.

  1. The API Call definition is below:

  2. The “Reinitialize call” returns data:

  3. Notice in the above screen shot that the returned data uses the email address being verified as part of the field name / object key.

  4. Here is the raw data which shows this as well:

  5. To make the field names more generic, the raw data is then edited from:

  6. To:

  7. Resulting in field names like this:

  8. And the ability to run the API call as an action (step 6 below), then save the values returned to various fields with a DB record (step 9):

  9. The problem is after that workflow runs, the DB records that are created do not contain data in the fields within the subobject emailAddressDetails:

And I have no clue why. Based on my understanding, that DB fields should contain value data returned by the API call, but don’t.

I would greatly appreciate someone who knows that area better than I do helping me understand what I’m doing wrong.

2 Likes

Hol’up! You can edit keys in the response (step 5 + 6) and the API Connector will still work?!

Also, this API’s response has a key that changes?! :thinking: I can imagine a key appearing or not but changing?! That must certainly break everything, no?

1 Like

This will work if the api match them. You cannot edit the response just to make it look the way you want. You need to fit the possible schema of the API service.

1 Like

Yes, you can edit the object returned by an API Call initialization, but it’s something you want to do sparingly, only when needed. The reason is if you ever have to reinitialize the API Call, you need to reedit it exactly the way you did the first time, or something in your application will break.

In my case, I provide a variable to the API Call which is an email address, then the returned object within the JSON response uses that email address as the object name, which I consider to be both wrong, and something I can not change.

Changing the name of the key will result in empty data as Bubble is looking for the data inside a key that doesn’t exist in the response.

Having said that, the email being used as the key will cause the same issue as it will be different each time.

You could set the response on the API call as text and use the Toolbox plugin to parse it and extract the data you need but that’s a bit of a hassle for something that should be straightforward.

Shoot! That makes sense. Bummer!