Skip to main content

Error message on mutation: API-change_column_value

  • September 2, 2023
  • 2 replies
  • 300 views

szabelin

Hello team,
I’m new to GraphQL and monday.com, though I’m trying to figure this query out. Wonder if there’s something I’m doing wrong in my javascript. If this is something simple, please advise:

const putInvoiceNumber = `
  mutation insertInvoiceJSON($board_id: Int!, $item_id: Int!, $columnValues: JSON!) {
    change_column_value(
      board_id:$board_id,
      item_id:$item_id,
      column_id:"text9",
      value: $columnValues)
    {
        id
    }
  }
`

let putInvoiceNumber_data = await queryFetcher(putInvoiceNumber,
      {     "board_id": board_id,
            "item_id": item_id,
            "column_id": "text9",
            "columnValues": {"text":"STA1004"}
       }, mondayToken)
console.log(putInvoiceNumber_data)


function queryFetcher(query, variables, key=bearerKey) {
    return fetch(api_uri, {
        method: 'POST',
        headers: {
            'Authorization': key,
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            query: query,
            variables: variables
        })
    })
    .then(res => res.json())
}


And here's the output of the console.log:

{
  errors: [
    {
      extensions: [Object],
      message: 'Cannot query field "change_column_value" on type "Mutation".',
      locations: [Array]
    }
  ]
}

Any help is greatly appreciated. All the IDs, tokens, and column_names are correct (because they work in the prior similar calls. Only failing to change this value.

One small edit,
From the APIplayground I can change the Status column:

mutation insertInvoiceData($board_id: Int!, $item_id: Int!, $column_id: String!, $value: JSON!)
{
  change_column_value(
    board_id:$board_id,
    item_id:$item_id,
    column_id:$column_id,
    value: $value)
  {
   		id
  }
}

with the value passed as this object:

{"board_id": 4894533225,
  "item_id": 5095877905,
  "column_id":"status",
  "value":"{\\"label\\": \\"Exception\\"}"
}

but changing the value object to the following is not working:

{"board_id": 4894533225,
  "item_id": 5095877905,
  "column_id":"text9",
  "value":"{\\"text\\": \\"STA1005\\"}"
}

Error message:
"error_message": "invalid value, please check our API documentation for the correct data structure for this column. https://developer.monday.com/api-reference/docs/change-column-values",

2 replies

szabelin
  • Author
  • New Participant
  • September 3, 2023

Found my bug, actually silly typo in the api_uri 😦


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • September 3, 2023

Hello @szabelin and welcome to the community!

I hope you like it here 💪

I am glad you found the source of the issue!

Let us know if you need anything!

Cheers,
Matias