so basically i am susing the moday api. here i want to filter the boards using borad name (as i have 100 + board) so i don't want to fetch all the baord..
after that i want to filter the items of that board using the checkbox.. value … like it should checked.. then return that records only whihch have checked the checked box..
using this api with api token… can you help to get the data...
document.getElementById("fetchBtn").addEventListener("click", async () => {
try {
// Fetch Board ID by Name
const getBoardsQuery = `{ boards(limit: 100) { id name } }`;
const boardsResponse = await fetch("https://api.monday.com/v2", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": apiToken
},
body: JSON.stringify({ query: getBoardsQuery })
});
const boardsData = await boardsResponse.json();
const board = boardsData.data.boards.find(b => b.name.trim() === targetBoardName);
if (!board) {
document.getElementById("result").textContent = `Board "${targetBoardName}" not found.`;
return;
}
const boardId = board.id;
// Get Columns to find your Status Column ID
const getColumnsQuery = `{ boards(ids: ${boardId}) { columns { id title } } }`;
const columnsResponse = await fetch("https://api.monday.com/v2", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": apiToken
},
body: JSON.stringify({ query: getColumnsQuery })
});
const columnsData = await columnsResponse.json();
const columns = columnsData.data.boardse0].columns;
const statusColumn = columns.find(c => c.title.trim() === "custom checkebox");
const statusColumnId = statusColumn.id;
// Fetch Only "Ready" Items Server-Side
const getItemsQuery = `
{
boards(ids: ${boardId}) {
items_page(
limit: 100,
query_params: {
rules:
{
column_id: "${statusColumnId}",
compare_value: "v"],
operator: any_of
}
]
}
) {
items {
id
name
column_values {
id
text
type
value
}
}
}
}
}`;
const itemsResponse = await fetch("https://api.monday.com/v2", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": apiToken
},
body: JSON.stringify({ query: getItemsQuery })
});
const itemsData = await itemsResponse.json();
if (itemsData.errors) {
document.getElementById("result").textContent = JSON.stringify(itemsData.errors, null, 2);
return;
}
const items = itemsData.data.boards 0].items_page.items;
document.getElementById("result").textContent = JSON.stringify(items, null, 2);
} catch (error) {
console.error(error);
document.getElementById("result").textContent = error.toString();
}
});