Hi,
I’m writing a function that updates certain items we have. Now when I use the create_update mutation, and send item_id as a variable I get:
{"errors":"{"message":"Variable myItemName of type Int! was provided invalid value","locations":"{"line":1,"column":11}],"value":null,"problems":"{"path":"],"explanation":"Expected value to not be null"}]}],"account_id":XXXXXXX}
However if I were to omit the variable, and enter the ID in code: item_id:YYYYYYYYYYYY the update works just fine. I am providing sample code under.
function testUpdate() {
global $token, $apiUrl, $headers, $generalBoardID;
$testID = YYYYYYYYYY;
//settype($testID, "Integer");
echo "item_id: $testID\\n";
echo "Datatype of testID: ".gettype($testID);
echo "\\n";
$query = 'mutation ($myItemName: Int!) { create_update (item_id:$myItemName, body:"HELLO") { id } }';
$vars = ='myItemName' => $testID];
$data = @file_get_contents($apiUrl, false, stream_context_create(e
'http' => ;
'method' => 'POST',
'header' => $headers,
'content' => json_encode(e'query' => $query]),
]
]));
$responseContent = json_decode($data, true);
echo json_encode($responseContent);
}
Any suggestions as to what is going wrong?