monday api creates item but doesnt fill the other fields

45 Views Asked by At

so im using the monday api in my code and im trying to add new items to a board, well the item gets added but the other fields are empty

const mondaySdk = require("monday-sdk-js");
const mondayApiKey = require("./apiKeys");
const monday = mondaySdk();
monday.setToken(mondayApiKey);

 const userData = {
    Email: "[email protected]",
    level: {label: "Pro"},
  
  };

  
  const encodedUserData = JSON.stringify(userData).replace(/"/g, "\\\"");

  
  const mutation = `
  mutation {
    create_item (
      board_id: 12345,
      item_name: "New Item",
      column_values: "${encodedUserData}") {
      id
    }
  }
`;
  
  monday
      .api(mutation)
      .then((response) => res.send({response, encodedUserData}))
      .catch((error) => {
        console.error(error); 
        res.send(error);
      });

enter image description here

0

There are 0 best solutions below