Saving 'raw body' text from API call broken

Has anyone here had any success in saving ‘raw body’ text returned from an API call as a thing in the database.

The context is that when we have uses create dynamic mapping to their data we need to be able to dynamically extract the mapped value via regex.

At first I thought there might be an issue with how Bubble treats normal regex expressions, so I went a step backwards and am now simply trying to save the ‘raw body’ as it’s returned from the api. The record being created is blank.

I should also mention we’re capturing headers and errors in the api call. The call itself works and we’re able to save any static fields being returned. When I say static I’m referring to fields that have been mapped when saving an initialized api call.

Thanks in advance for thoughts on this… certainly seems like a bug.

You can give a field in the database a type from an API return. Then save it to that field.

Hi @williamtisdale, that doesn’t seem to do the trick. Essentially I’m returning many records from an API call and using the bulk api endpoint to create a record for each item.

When using the api response for bulk creation (in the screenshot below) every field works for saving in the database except " 's raw body text"

Not sure if you’ve encountered this before but would appreciate any additional thoughts.

I have just struggled with this for about 3 hours. I finally figured out that you need to set up your api in the backend workflow with the correct steps.

  1. Make sure you select Include headers in the detected data first.
  2. Click detect data and wait for incoming webhook to populate fields.

Make sure you do not untick the “Include headers in the detected data”. You will now have access to Request Data’s raw body text
Shared with Zight

I wish they just hid that option “raw body” if you did not have it set up correctly. It was so confusing trying to figure out why I couldn’t access the raw body on an existing API.

It does not work simply checking Include headers in the detected data on an API if you haven’t actually detected the data without that box checked!

If you do not follow these steps and want to convert your Bubble API (backend workflow) to capture the raw body, you will need to redect the data with that box checked. This will cause issues for every step in the workflow that references the Request data. So be prepared to fix all these once you do this.

1 Like

Well, for those who find this via search later, as of today, this is a terrible UI bug, confirmed by support. You can only access the raw body text at the highest level. Meaning even though you can loop through the results and see the option in the UI to use raw body text, you, in fact, cannot.

Therefore, there are a couple of options. The first is to limit your API results to 1 and make a ton of calls to use the raw body text (which is absurd) or look at a more traditional programmatic solution. I imagine the best approach would be to use AWS lambda to create a sidecar backend to bubble, use python to parse the responses, and hit the Bubble API to update the database.