How to call change_multiple_column_values in Python

Does anyone know how to correctly call Monday’s API to use the change_multiple_column_values mutation using Python? I’m running into an issue with the fact that the entire mutation call is required to be encapsulated in a string, combined with the backslash requirements of the API call. There is no way that I can find in Python to provide the appropriate string with ONLY ONE backslash as documented. For example, the following, converted to a complete string in Python, would either result in no backslashes altogether, or two backslashes (to force the backslash with an escape), either of which are then rejected by the API server when packaged into the JSON object and sent via requests:

mutation
{
  change_multiple_column_values (board_id: 12345678,
    item_id: 0987654321,
    column_values: "{\"text\": \"My Text Here\"}")
  	{
    	     id
  	}
}

Thanks for the help!

B

1 Like

Hey Ben!

Dipro here – happy to help :crystal_ball:

I’d suggest using Python’s amazing JSON library to convert dictionaries into JSON strings (and vice versa). This approach lets you avoid having to deal with pesky backslashes :fish:

An example that uses json.dumps can be found here: API Code Example: Importing existing Zendesk tickets using the API - #3

Let me know if that helps :slight_smile: