Trying to get a list of cards from a specific user on a specific board


I’m trying to pull back all the cards on a board where a specific user is a member, and the only way I can see to do this is to use the search function which doesn’t seem to be working as I’d expect.

I’m just using a simple php curl request to get the data via the API with the following code

$query = "@$username board:$boardID";
$cardsLimit = 5;
$cardFields = "name,url";

$curl = curl_init();
curl_setopt_array($curl, array(
    // use a search query
    CURLOPT_URL => "" . $query . "&cards_limit=" . $cardsLimit . "&card_fields=" . $cardFields . "&key=" . $apikey . "&token=" . $serverKey,
       "Accept: application/json",
$response = curl_exec($curl);  

I know the username and the board id in advance, and when i use the same query (something like"@user_name board:1239876scsjkh198kjs") in Trello’s search it works fine and pulls back the expected results, but via the API I get no results.

If I modify the query above to the following it does return cards as expected so I know the API call works ok.

$query = "@$username";

but if I modify it to be just that board it returns nothing whereas the UI in trello returns cards fine (although I need a space, which I have tried in the code too, e.g. “board: 12387kh21498gh1322g”)

$query = "board:$boardID";

I feel like I’m either missing an easy way to filter cards on a board by user, or not quite getting the search functionality right? Can anyone point me in the right direction?

Anyone? I think this might be a bug in the search API as the board: option always fails for me

The API endpoint for getting cards on a board will have an array of idMembers that you can use to cross reference.