Using API via PHP - Info missing from tutorial

I am attempting to follow the API tutorial for PHP here:

API Quickstart Tutorial - PHP – Support (monday.com)

As you can see from my attached image there are some words missing at the end of that sentence.

When I run that code (with my API key added, I get null in my browser)
I tried to replace ‘id name’ with the board ID as well and got the same.

I chatted with support, and they told me they would have the article fixed asap, but in the mean time can someone help me? I’m not verry experienced in this field in the first place so I may be missing something obvious, but the sentence on the tutorial is also incomplete.

I went further down and tried another section of the tutorial for creating an item since that is what I’m trying to achieve anyway and that section is free of typos. Still getting ‘null’

So this is my code:

<?php

$token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

$apiUrl = 'https://api.monday.com/v2';

$headers = ['Content-Type: application/json', 'Authorization: ' . $token];

$query = 'mutation{ create_item (board_id:XXXXXXXXX, item_name:"HELLO WORLD!") { id } }';

$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);

?>

Pretty sure my PHP env is working, if I replace this code with code that just echos html it works.

Anyone know where I’m going wrong?

Thanks!

Hello there @hderic,

I see the article is now fixed :slightly_smiling_face:

Regarding your issue, would you please send an email to appsupport@monday.com so we can take care of it over there?

Please include the script you are using and the exact response you get.

Please also send a screenshot of your Playground trying that query there. Include in the screenshot the query and the response please.

To use the Playground:

  1. Click on your profile picture or initials

  2. Click on “Developers”

  3. Click on “Developer”

  4. Click on “API Playground”

Looking forward to hearing from you :slightly_smiling_face:

Cheers,
Matias