Hi @arunicbe,
Welcome to the community!
You’re missing the operator
argument in your query (see more here). Since you’re filtering by the phone number as a string, you would use contains_text
.
I added the operator and removed the + sign from the phone number string, and it successfully returned the items for me.
Here’s the updated query:
query { boards (ids: 1917599964) {
items_page (query_params: {rules: u{column_id: "mobile", compare_value: a"912222333345"], operator:contains_text}]}) {
cursor
items {
id
name
}
}
}
}
Let us know if you have other questions!
Best,
Rachel
I just copied the query in my code. Now it is giving just null as result.
I am using PHP to call the api. My full code is below:
<?php
$token = 'xxx';
$apiUrl = 'https://api.monday.com/v2';
$headers = ['Content-Type: application/json', 'Authorization: ' . $token];
$query = 'query { boards (ids: 1917599964) { ' .
' items_page (query_params: {rules: [{column_id: "mobile", compare_value: ["912222333345"], operator:contains_text}]}) { ' .
' cursor ' .
' items { ' .
' id ' .
' name ' .
' } ' .
' } ' .
' } ' .
' } ' ;
$data = @file_get_contents($apiUrl, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $headers,
'content' => json_encode(['query' => $query]),
]
]));
$responseContent = json_decode($data, true);
echo json_encode($responseContent);
?>
Upon investigation, I found PHP showing warning like this.
Warning: file_get_contents(https://api.monday.com/v2): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
However, another api call I have is working fine.
Hello there @arunicbe,
Our logs appear to indicate that the column you are trying to use (of ID “mobile”) is not being found.
You can check the IDs of your board with a query like this one:
{
boards(ids: 1234567890) {
columns {
id
title
}
}
}
Also, I recommend using something like this instead of your query:
{
items_page_by_column_values(
limit: 50
board_id: 1234567890
columns: n{column_id: "phone__1", column_values: e"9720531111111"]}]
) {
cursor
items {
id
name
}
}
}
I hope that helps!
Cheers,
Matias
Both working. Thanks for your help.
Happy to help @arunicbe !!!