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 = ‘https://api.monday.com/v2’;
$headers = [‘Content-Type: application/json’, 'Authorization: ’ . $token];
//var_dump($headers);
//print"
";
$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);
var_dump($responseContent);
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
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:
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 Monday.com 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 Monday.com terminology at what the user see’s and what I’m dealing with in the API.
Thanks Greg
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:
- Open your monday account
- Click your avatar icon in the top right (bottom left if you’re on the old layout)
- Select “Developers”
- 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.
Thanks for the rest of the info will look at it further when I get a chance today.
regards Greg
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.