Event condition passed

Trying to figure out why when API workflow searching a table:

Need to return 400 when item not found. Instead it returns 200 “Event condition passed” with empty return string. On the workflow there is a check box “Return a 200 if condition not met” but it is unchecked. Can anyone offer advice on this? Thanks!

Even when you get this message, the error code that returns to the caller of the api, its different.

When the checkbox is unchecked, the return is an error 400.
When the checkbox is checked, it returns an sucess 200.

This images are tested from Postman just for you can see the difference.

Unchecked:

https://puu.sh/zA5SW/628b6f7013.png

Checked:

https://puu.sh/zA5V1/1293adbb06.png

So basically, if you need return 400 when item not found, dont check the box, even if you get that message you are returning 400 error to the caller.

Thank you for this. Dropsource is reporting the 200. The traffic from web based app simulator in Dropsource is not visible in Chrome tools - which is odd. Thank you for the screen shots - Postman is exactly the tool I need.

Running Postman - odd went to odder.

When attempting to search on the ‘products’ obj it returns all products regardless of input params.

When using wf search Postman reports that GET fails and to use POST - which makes no sense since I am trying to GET.

Not sure where to go from here.

Show me how are you searching it (the URL are you attempting to post)
And also the condition that is trying to pass.

Search products object at:
https://sample.bubbleapps.io/api/1.1/obj/products

Returns all rows in table, as expected.

Search for specific code in table at:
https://sample.bubbleapps.io/api/1.1/obj/products?upc_=096619756803

Still returns all rows, when expected to only return row with this upc

I think you are using GET instead of POST.

I created a little scenario where i try to find a user by the unique id.
So i created an Endpoint with name: “blank”.

https://puu.sh/zADur/a2bafe20d2.png

So i need search by uniqueid, so i created a parameter with id name and text type.

After that i created an workflow that returns API data.

https://puu.sh/zADyJ/fab03649d5.png

And in this case we are sending a value through the POST so we will need to filter only to the user that match with the unique id we are sending.

https://puu.sh/zADBw/dd2a75ca58.png

So when we run the api with an existing unique id of any of the users are created in the db this is the result:

https://puu.sh/zADEy/cf2390da76.png

Please note that values must be sent in form-data:

https://puu.sh/zADGM/fb80f6581c.png

Thank you for that.

I created table ‘products’ & added sample data

I created wf ‘findnamebyupc’

image

…and return from API

image

image

In Postman:

adding form data key upc_ sample data with code present in table:

It returns data as expected.

When changing form data in Postman to something that is not in table (9999999999):

The response is 200… and empty.

I am hoping for a 400.

Cool that’s a big step, now you are getting the data as expected.

Now for return 400 you should Filter in the api endpoint like this (in my case with the users):

https://puu.sh/zAFro/f918a3eaf3.png

We dont need to apply any kind of constraint in the search because we are looking if that “id” exists in our db. If yes, then it will return the api response with the user details:

https://puu.sh/zAFnc/6ef1e1732d.png

And in case that ID doesn’t exists in our db will return a 400 error:

https://puu.sh/zAFlM/89546c418a.png

So when I click on that area no options present themselves:

image

…and then clicking…

image

it says Search but does not load any options.

Reload your page/browser. It should appear like this:

https://puu.sh/zAG6m/5c72e55eab.png

Replicating this like so:

image

Is perfect.

Thank you, thank you, thank you. :slight_smile:

You welcome :wink: