Skip to main content

Date Column Problem with API

  • January 14, 2021
  • 2 replies
  • 2272 views

Hello, I’m having trouble creating a subitem via the API with the Date column automatically filed. The subitem is correctly created, and I have no problems with other columns, but the date column just will not update. It is left blank on every created subitem.

Any thoughts on what I’m doing wrong below?

I’m using PHP. Here is my code:

$query = ‘mutation ($myItemName: String!, $columnVals: JSON!) { create_subitem (parent_item_id:(redacted), item_name:$myItemName, column_values:$columnVals) { id, board { id } } }’;
$vars = [‘myItemName’ => ‘TestItem’,
‘columnVals’ => json_encode([
‘status’ => [‘label’ => ‘Done’],
‘Date’ => [‘date’ => ‘2021-01-02’]
])];

$data = @file_get_contents($apiUrl, false, stream_context_create([
‘http’ => [
‘method’ => ‘POST’,
‘header’ => $headers,
‘content’ => json_encode([‘query’ => $query, ‘variables’ => $vars]),
]
]));
$responseContent = json_decode($data, true);

echo json_encode($responseContent);

This topic has been closed for replies.

2 replies

Forum|alt.badge.img
  • monday.com Team Member
  • February 1, 2021

Hi @zonajustin!

Hmm that’s weird-- it looks alright to me.

It looks like your columnVals are also being encoded in JSON format, right?

What’s the error that you’re getting? Or is it just that the Date column is empty and there’s no error message?

Thanks for walking me through it!

-Helen


Forum|alt.badge.img
  • monday.com Team Member
  • March 15, 2021

Hi @zonajustin! If this issue is still popping up, feel free to create a new thread or email into appsupport@monday.com.

Closing this one for now.