However, the next step in the process for me is to integrate this into Java code. I have managed to post the data with authentication and so on which works fine. However I struggle greatly with formatting the body correctly so that the above mentioned query gets executed. Could anyone kindly help me as I am at a loss how to actually format it correctly? At the moment the error code I get by the post is code 400.
I have tried many different variations to no avail with my latest try being the following:
I’m new here so I may be mistaken, but I think I was just having the same issue with formatting.
In your body it you have quotes around the data types i.e {“text”:“test1”} should be {text:“test1”} and so on for each data type. Be sure to check the data type each pair needs, I believe numbers7 would need an int not a string.
String body = “{ query: mutation { change_multiple_column_values(board_id: XXXXXXXX, item_id: XXXXXXXX, column_values: {text:“test1”, numbers7:0, date: { date : “1955-10-08” }}) { id }}}";
Alex is right on the mark – each column type needs a different format of data.
On top of that, you need to ensure that your program is sending the correct strings to the API. From your example, it looks like your quotes are not paired correctly. I would suggest escaping inner quotes so they don’t get interpreted literally as the end of a string:
I am testing with your advice right now and have the following body. However I haven’t managed to make it work as of yet. In case you see any mistakes please do not hesitate to say so. I will update with a new post if I manage to get it going.
String body = "{ \"query\": \"mutation { change_multiple_column_values(board_id: XXXX, item_id: XXXX, column_values: {text:\"test1\", numbers7:100, date: { date : \"1999-01-01\" }}) { id }}\"}";