Does anyone have best practices on how to inspect and debug API calls with the API plugin?
I have built an API plugin and the first step is to check with the other service if data already exists. I want to continue the workflow based on the response. In order to properly do that, I need to be able to firstly inspect the response to then try and handle it.
Does anyone have a good way to do this?
First you need to initialize your call.
When done, trigger your Api Call, and set your actions depending on the response :
Tell me if it is clear
Not quite what I meant though. I had to manipulate the data before giving it in by splitting the text string. So I needed to debug it to see what’s going in and out. But there is no way to log the response from the API when used in a workflow as far as I know.
When you say you have built an ‘API plugin’ … Do you mean you are creating a plugin for bubble?
Mostly I debug backend workflows using a log file write at each step.
@NigelG oh sorry for being unclear.
I was simply using the API connector to connect to another service.
Let me give some more context…
I have to hand over firstname and lastname to the API input.
However, I store names as a single name string in the DB.
So, I have to manipulate the data before giving it to the API input and wanted to check how to best do that.
I used the “split by…” operator now. I take the :first_item as firstname and last_item as lastname.
This is not ideal though because I can’t do any proper checks of the string.
Someone has a double name…
Someone has used an emoji in their name on the site where I scrape the data from…
Yea… so, not ideal.
OK, so you want to output the split name somehow before you call the API?
I would use a log table and just write to that.
That’s what I did in the end.
I think it would be a great feature update to have something like a console.log() in future for easier debugging.
@umit1 you can use console.log() for server side actions, and you should be able to get some visibility from the API calls using the following options in Server Logs. You will need to click ‘Show Advanced’ to surface them.
Yeah, although it is probably quicker to set up a “log” table with type/text1/text2 etc - I do this with every new Bubble app.