In App API result is different from API test result (In App is a fail)

I am trying to pull data from a REST API. It works in the test data area, but not in the app (confirmed by the debugger).

When I try it in the testing area I use this as the variable value: { “advf”: { “e”: [ { “_name”: “Contact”, “rule”: [ { “_op”: “contains”, “_prop”: “Full name”, “values”: [ “Ryan” ] } ] } ] } } and it pulls the data just fine.

In the app, everything else in this variable is static other than the bolded section, which is a page variable controlled by a search bar. That formula looks like this ‘{ “advf”: { “e”: [ { “_name”: “Contact”, “rule”: [ { “_op”: “contains”, “_prop”: “Full name”, “values”: [’+"("+pageVars.Searchtext+")"+’ ] } ] } ] } }’.

Once that variable is changed it triggers a flow that performs a Get Record Collection on the API.

The problem is the output of that Get Record Collection ends up being an error that looks like this

{ 4 items
“name”:string"records"
“type”:string"dataResourceListResponse"
“title”:string"Collection of records"
“description”:string"The successfully retrieved collection of records."
}

1
{ 6 items
“name”:string"error"
“type”:string"object"
“title”:string"Error"
“properties”: {} 3 items
“description”:string"One of the following error codes: - requestFailed : Thrown if the entire request failed due to e.g. CORS issues or no network connectivity. - serverError : Thrown if the server returned an error response. - unknown : Thrown if an unknown error occurred while fetching the collection of records."
“value”: { 4 items
“code”:string"serverError"
“status”:int400
“message”:string"JSON error response from server: {“success”:false,“error”:“Invalid query.”}."
“rawError”: { 2 items
“success”:boolfalse
“error”:string"Invalid query."
}
}

I think its because the formual ends up making the input look like this: “{“advf”:{“e”:[{”_name":“Contact”,“rule”:[{"_op":“contains”,"_prop":“Full name”,“values”:[LOOKUP(pageVars,“Ryan”)]}]}]}}"

and that does not return any data in the testing area.

Any ideas on how to structure this formula?

First of all, I think you will need to escape all the " characters with a , like ". So I would expect your formula to look something more like this:

“{ \“advf\”: { \“e\”: [ { \“_name\”: \“Contact\”, \“rule\”: [ { \“_op\”: \“contains\”, \“_prop\”: \“Full name\”, \“values\”: [ \“Ryan\” ] } ] } ] } }”

Try with a static Ryan there before you try to insert the dynamic part and get that working first! Let me know if this helps or if you got stuck again!