Multiple filters in post process server script $get call

I am trying to filter the data in a php server side script and apply 2 filters at the same time. The filter value is ignored. Please help

$followGetData = [“filter” => array(‘follower_id’ => ($userID),
‘following_id’ => ($data[‘user_id’])

$followGetCall = $get(“mysql/_table/follow_relationship” , $followGetData);

The $followGetCall returns all entries in that table, instead of filtering by the 2 columns.

Thank you.

I have tried this also

$followGetData = [“filter” => (‘follower_id=’.$userID.’ and '.‘following_id=’.$data[‘user_id’]) ];

But I get “Field ‘follower_id’ must be a valid integer.”


Not sure about filter formatting, but if you want to provide a filter in the payload you need to do what I call a GET by POST.
Here’s how it works, put your filter into the payload (which you’ve done above)
now add a header "X-Method: GET"
Now perform the API operation as a POST rather than a GET.

I solved it. the “()” must be included in the string, so the variable between them is read as an integer .

$followGetData = [“filter” => ‘follower_id=(’.$userID.’) and ‘.‘following_id=(’.$data[‘user_id’].’)’ ];

1 Like