Unable to set Column_Values for certain ColumnIDs

I’m trying to create a new item in a board , and am passing a JSON object containing the column_values for several columns. I’m having luck with certain text columns. But others, The API returns the following error

{
  "error_code": "InvalidColumnIdException",
  "status_code": 400,
  "error_message": "This column ID doesn't exist for the board",
  "error_data": {
    "column_id": "email"
  }

I am getting the error even though the column ID does indeed exist in the board.

{
    "id": "email",
    "text": "email@email.com",
    "title": "Email",
    "value": "{\"email\":\"email@email.com\",\"text\":\"email@email.com\",\"changed_at\":\"2020-01-24T04:36:25.922Z\"}"
},

Any Insight?

These are the variables that I am passing to the mutation. I can get this to work for the simple text field or a group of two text fields , but get the above error when passing the email column id.

{"name" : "NewCo Insomnia", "group" : "groupID", "JSON": "{\"text7\": \"ready 7\" , \"email\" : \"email@email.com\"} "}

Also, Is there a way to edit the ID values , or set them when the column is created ?

Thanks,
Javier

I found a way around this , although I’m still not sure what the original issue was. Maybe a syntax.

For anyone else running into issues . I am doing this in Powershell Core .

The gist of if was changing the way that the JSON object is built and handed to the API request .

$column_values=@{
   ##owner Column
   person = @{personsAndTeams = @(@{id = $lead; kind = "person"})};
   ##world clock
   world_clock = @{timezone= "US/Pacific-New"};
   ##phone
   phone = @{phone=$phone; countryShortName=$country}
   ##address
   text = "$address";
   date = @{date = "2019-01-20"};
}

The first thing is to build a hash table containing the key / value pairs made from the column_id and desired value for your create_item mutation .

For column types that require complex json definitions, define the value in a power shell hash table.
ei . the phone column above shows a nested object , the person column above shows a nested object with an array containing another object.

We can then convert the hash table to JSON notation and compress the spacing to match the API requirements.

$hashJSON = $column_values | ConvertTo-Json -Compress -Depth 50 | % { [System.Text.RegularExpressions.Regex]::Unescape($_) }

and use the replace function to add the \ used to cancel out the "

$hashObject = $hashJSON.Replace('"','\"')

Finally , We can make the API call to create the new item

$itemTable = ""
$newBoardItem = @{}
$newBoardItem = @{

##Create Item in board
  query = "mutation(`$JSON:JSON!, `$name:String!) {create_item(item_name: `$name, board_id: $boardID, group_id: $groupID, column_values: `$JSON ) {id}}"  
  variables = "{`"name`" : `"NewCo PowerShell`", `"JSON`" : `"$hashObject`"}"
}
$itemTable = Invoke-RestMethod -Uri $Url -Method Get -Headers $headers -Body $newBoardItem`