Null value being returned when trying to get boards

Using the following code I get the value of null returned any idea why. I have the correct token which isn’t shown here for security reasons.
$apiUrl = ‘’;
$headers = [‘Content-Type: application/json’, 'Authorization: ’ . $token];

$query = ‘{ boards { 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);

Hi @Aussiegreg

First of all, welcome to the community and thank you for using this platform and asking for assistance.

I sent your question to the tech team and it should be answered soon.

Hope to see you around.

Have a wonderful day :slight_smile:

Hey! Is the API returning a null value, or is the value of the $responseContent variable null?

You also have some extra characters on line 6 which cause a syntax error.

Once I deleted those, I tried running your code and it worked fine:

And here’s the code, for reference:

1 Like

Hi Dipro,
The var_dump($responseContent); was returning the value of null as in the word was being return, it wasn’t returning an empty value, yea the word does confuse people.

I have since discovered the code shown in the documentation was incorrect, and have now been able to retrieve the list of board ID’s and their names.

Now I am trying to retrieve the information from specific boards, I can specify which of the boards I want info from but not sure which query to run to get all or some columns from these boards as I’m really confused between terminology at what the user see’s and what I’m dealing with in the API.
Thanks Greg

1 Like

Ah, so the variable was null (not the response from the API).

To understand the structure of data, I’d recommend making some sample queries in our API playground. It’s basically an environment to easily make queries and mutations on your live data.

You can access it by following these steps:

  1. Open your monday account
  2. Click your avatar icon in the top right (bottom left if you’re on the old layout)
  3. Select “Developers”
  4. Select “API playground” in the left pane

Also check out our GraphQL overview here, to get a feel for the query language: Intro to GraphQL

BTW which article is incorrect? I’ll review it.

And here’s a screenshot showing the API playground:


Sorry you might have misunderstood me, the response from the API was the word NULL.
The code and link to the code I used.

<?php $token = 'YOUR_TOKEN_HERE'; $apiUrl = ''; $headers = ['Content-Type: application/json', 'Authorization: ' . $token]; $query = '{ boards { 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); ?>

Thanks for the rest of the info will look at it further when I get a chance today.
regards Greg

1 Like

Oh very odd… Thank you for clarifying – haven’t seen that myself but will keep an eye out for that behaviour with other customers to see if we can find the root cause.

Let me know if you have further questions once reviewing those links.

1 Like