API Issues with POST reqeust

Hi there,

Can anyone tell me what is wrong with my payload? I keep getting a 500 error back, which from my reading on the board, signifies a malformed request. I am not using Node.js or similar back end software. I am using an ETL software that allows for web requests. So I am really trying to find out what the issue is in terms of the structure of the request rather than the code that makes the request like I have seen in other posts.

In the response back I have removed the urls for the content-security-policy because I am limited to a max of 20 urls in a post. Additionally, the beginning of the auhtorization key is x’d out. The key itself is fine. I just didn’t want to post it in the forum. Please assume there is no issue with the authorization key.

If anyone could give me some pointers, I would be appreciative. Thanks!

Payload:

POST https://api.monday.com/v2/
Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxNToyNy41MTdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6OTk2Nzk3NywicmduIjoidXNlMSJ9.mHuTjTWVAdmNxuz5gWUoglXL46-0caqPAbN76xuZaVU
Accept: application/json
Content-Type: application/json; charset=utf-8

{
“query”: “mutation ($myItemId:Int!, $myBoardId:Int!, $myColumnValues:JSON!) {change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) {id}}”,
“variables”: {
“myItemId”: 2443401735,
“myBoardId”: 2128789134,
“myColumnValues”: {
“state”: “Released”,
“ceid”: “Tiger88”
}
}
}

Response:

HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Connection: keep-alive
vary: Origin, Accept-Encoding
x-request-id: 003a1736-c14d-4feb-9b82-6988c3082777
x-runtime: 0.028100
x-envoy-upstream-service-time: 204
content-security-policy:
x-robots-tag: none
x-xss-protection: 1; mode=block
x-monday-rgn: use1
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
CF-RAY: 6ef6f9adb86fdedd-SEA
Cache-Control: no-cache
Date: Mon, 21 Mar 2022 13:18:45 GMT
Set-Cookie: __cf_bm=mwKjRF43wvjb07Csd84.jCtnK.DwZYvFJPRKoe0.YBk-1647868725-0-AWuMl14Wso5Rf2wE9Ce6PLXTEpxL/eFc5uKAVIRfVh0hq2/FrutBBrn31zRL5fifm5MZ3VwIAGnwQ3RZ50y0nQXPVz6QMWRMRqya323Kalp6; path=/; expires=Mon, 21-Mar-22 13:48:45 GMT; domain=.monday.com; HttpOnly; Secure
Server: cloudflare
Content-Type: application/json; charset=utf-8

{“error_message”:“Internal server error”,“status_code”:500}

I may be wrong, but I think it’s that the brackets following “myColumnValues” (around both of your column entries) need to be included in the quotes too.

example: "{\"state\" : \"Released\", \"ceid\" : \"Tiger88\"}"

or… what I do is build out the column value variables before I get to this stage so I’ve got an array of all the column ids & values… logger output looks like ["state" : "Released", "ceid" : "Tiger88"]… I call my array var mondayRow… then when I get to the payload part I say:
"myColumnValues": '{' + mondayRow.toString() + '}'

I’m working in GAS, and to me it looks like there is more to this that is wrong, but there’s a good chance that’s just because maybe I have to send the request a bit differently than you. Let me know if you’ve not been able to get any request to work at all (like a simple query instead of a mutation) - if you’ve had no success I’ve got other ideas on what you need to change, but if you have had success in other requests then I think it’s the brackets needing to be in quotes.

@TheWes

Thank you for the reply. This was enough of a hint for me to get it figured out in the ETL software I am using. The actions in my ETL tool that constructs JSON does create it correctly but I was getting strange escaping characters in the payload. The tool doesn’t have functionality strictly formatting for GraphQL requests.

I ended up having to use your approach of creating an array when I construct the json
‘{’ + mondayRow.toString() + ‘}’ like you indicated except instead of toString, the result just exists as a value in a column in the table. I then had to explicitly remove the “{[” and “]}” from the result in order to get it format correctly.

For anyone trying to look this up in the future, though a slightly different example from the initial post, as the below query portion of the payload is for creating and item and setting certain columns on creation instead of just updating multiple columns on an already existing entry, the payload should look something like the below.

{
“query”: “mutation ($myBoardId:Int!, $myItemName:String!, $myColumnValues:JSON!) {create_item(board_id:$myBoardId, item_name: $myItemName, column_values: $myColumnValues) {id}}”,
“variables”: {
“myBoardId”: 2128789134,
“myItemName”: “111”,
“myColumnValues”: “{“state”:“Released”,“release_date”:“2022-02-12”}”
}
}

Sorry, the escape characters from the payload are getting removed from the post so attaching an image as well.