Fetch data from board using PHP and new API Version 2024-01

HI all, i have an issue Fetching data from board using PHP and new API Version 2024-01. it was working fine from previous version.

Thus far, I have made the following changes:

  1. added API=version at the end of header
    $headers = [‘Content-Type: application/json’, ‘Authorization: ’ . $token.’, API-version : 2024-01’];

  2. I changed the query to include items_page
    The query works perfect as it works fine and returns results on
    monday.com

query {
boards (ids: 12344444444)
{ items_page {
items { name column_values
{ id type text }
} }}
}

  1. I am trying to parse the content, but get stuck here as I get null results
    foreach($responseContent[‘data’][‘boards’][‘items_page’][‘items’][0] as $mydata){
    or
    foreach($responseContent[‘data’][‘boards’][‘items_page’][‘items’] as $mydata){

Looking forward to your assistance/guidance

Thank you in advance

Paste the query into the graphql developer console first to test it works (selecting the correct api version).

If it works, try:

print_r($responseContent);

To see what you got back from the API.

It would be really cool if all results returned also had the api version displayed, so you know whether the version is that one you think you’ve specified @Matias.Monday

1 Like

hi DAvid,

thank you for quick reply and advice

I used the below and it prints out correct the data found in the board, but cant manage to parse it using id or or column value

echo json_encode($responseContent);

If you’re getting the correct data back from monday, then all is “good” :tada:

The following is your friend as it will show you the shape of the PHP array/object returned:

print_r($responseContent);

It’s just a matter of parsing the arrays/objects returned using PHP.

Good luck.