Hey Monday dev community,
After updating the API version I’m struggling with what seems like a formatting error. I can’t seem to understand what is wrong with the format though.
Here is the error I’m getting:
{
"errors": [
{
"message": "Invalid GraphQL request",
"extensions": {
"details": "failed to deserialize the request body into JSON: invalid type: string \"{\\\"columnValue\\\":\\\"29.9772962 31.1324955 4420 148th Ave NE bldg 127, Redmond, WA 98052\\\",\\\"columnId\\\":\\\"location_1\\\",\\\"itemName\\\":7279384567,\\\"myBoardId\\\":4499094121}\", expected a map or null at line 1 column 425",
"code": "INVALID_GRAPHQL_REQUEST"
}
}
],
"account_id": 11622012
}
Here’s the step in the code that’s failing:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
monday: {
type: "app",
app: "monday",
}
},
async run({steps, $}) {
const bookingID = steps.trigger.event.body.event.pulseId;
const userItems = await axios($, {
url: `https://api.monday.com/v2`,
method: `POST`,
headers: {
'Content-Type': 'application/json',
'Authorization' : `${this.monday.$auth.api_key}`,
'API-Version' : '2024-10',
},
data: {
"query": `query {items(ids: [${bookingID}]){name column_values {id value text}}}`
}
});
const projectName = userItems.data.items[0].column_values.find(x => x.id == 'status89').text;
const locationKey = {
"test B127": "test addres 1",
"test B124": "test address 2",
"test B25": "test address 3",
}
if (projectName === null) {
console.log('no project name');
return;
}
const addressToAdd = `22.2772962 31.1324955 ${locationKey[projectName]}` ?? "22.2772962 31.1324955 Update";
console.log({addressToAdd});
const data = await axios($, {
url: `https://api.monday.com/v2`,
method: `POST`,
headers: {
'Content-Type': 'application/json',
'Authorization' : `${this.monday.$auth.api_key}`,
'API-Version' : '2024-10'
},
data: {
"query" : "mutation ($myBoardId:ID!, $itemName:ID!, $columnId: String!, $columnValue: String!) { change_simple_column_value(board_id:$myBoardId,item_id:$itemName, column_id: $columnId , value: $columnValue) { id column_values{id text value}} }",
"variables" : JSON.stringify({
"columnValue": addressToAdd,
"columnId": "location_1",
"itemName": steps.trigger.event.body.event.pulseId,
"myBoardId": 4499094121,
})
}
})
},
})