Skip to main content

Mutation on column value works via API Playground but not via REST-

  • January 17, 2023
  • 3 replies
  • 683 views

jonstevens

In the API playground, I can change a column value using

mutation {change_simple_column_value (board_id: 12345, item_id: 54321, column_id: "text3", value: "{00002_0000067584}") {id}}

But if I send the folowing in my JSON request to the API endpoint, I get a 500 error

{"mutation": "mutation {change_simple_column_value (board_id: 12345, item_id: 54321, column_id: "text3", value: "{00002_0000067584}}") {id}}"}

I have also tried without the {} but I get the same error.

My guess is I am constructing the JSON incorrectly to resolve to GraphQL but I have exhausted different approaches, what am I doing wrong?

Jon

3 replies

Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • January 17, 2023

Hello there,

I am not sure how you are sending the HTTP request but I have a few notes that might help:

This is not a REST API, it is GraphQL.

The request is always a POST request

The endpoint is always the same one: https://api.monday.com/v2 (unless you are uploading a file)

Here is a Postman example on change_simple_column_value

As you can see in that example, you can use something like this (again, this is Postman):

{
    "query": "mutation {change_simple_column_value(item_id: 1234567890, board_id: 1122334455, column_id: \\"text\\", value: \\"Some text\\") {id}}" 
}

I hope that helps!


jonstevens
  • Author
  • New Participant
  • January 17, 2023

Thank you that solved it, two issues

I did not have the /" escape and I was also sending “mutation” instead of “query” at the start of the string.

Changed that and it worked straight away, thank you

Jon


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • January 17, 2023

Hello @jonstevens ,

Glad to help!

Let us know if you need anything else 🙂

Cheers,
Matias