Capture API HTTP error response

Hi again,

When using a custom action to make an API call, is it possible to capture and store or display the HTTP response? e.g. 200, 400, 500, etc

I’m making a Stripe API call and if there’s an error, there’s no way for the user to see if anything went wrong, the screen just doesn’t do anything (I can see in the Stripe logs the status).

I know @Victor had previously said Integromat was one solution, but trying to keep it all in Adalo…


1 Like

Just bumping this… Is it possible to capture response codes from API calls? While it’s great we can call an external API, not knowing the success or failure of the request isn’t great for a production app.

Hi @paulh, there is no way to get non-200 responses into your Adalo app. It does get logged into the developer console so you can see it in preview and web mode, but there is no action you can take like “Display a message if an API call failed”, this is true for both External API calls and for Adalo standard calls. An example of how Adalo manages failues is like this

  if (action.type === `${CREATE_OBJECT}_REJECTED`) {
    console.error('ERROR', action.payload, action.meta);

so unless you hook into and overwrite the fetch call (pretty advanced coding required) in the app you cannot display anything. Using an intermediary like Integromat is a viable option where you can return 200 code to Adalo and include the failure message as part of the payload, keeping in mind that if the Integromat call fails, you are stuck in the same boat.

Thanks @TKOTC. Yeah trying to avoid using another service (another thing that could break). So not sure what is better/worse, not getting response codes or adding an intermediary API call (double API requests). I guess a third option is to make a get request and see the transaction or see if Stripe has a webhook for transactions. But that’s just extra work…

One of these days I’m just going to have to learn to code or pay someone…

Hi @paulh @TKOTC

I’ve created a Feature Request here Custom Action Response Codes | Voters | Adalo - please don’t hesitate to upvote it.

I’d love to see the full debug capabilities for custom actions, but adding response codes is (as for me) quite simple, but will allow us to track failed executions much better.

Best regards, Victor.

1 Like

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