API access to a specific column value on an individual item with PHP

I’m new to the api but have worked with quite a few others and I’m stumped on how to actually return an individual item value of a specific column that is not a board default like id or name. I’ve enabled dev mode to be able to see what the actual api column ids are and have tried in many different iterations of calling the specific one…in this case, the column id is just text__1 according to the output on the header of the one I want. I’ve got my main loop from the items page working fine. I’ve got the individual item id from the loop…but every item query I try, I get an error saying the column text__1 doesn’t exist on Items.

Is there some magical formula that’s required to simply just return the value of a custom column from the api?

Thanks in advance.

Hello there @netadmin_cf8594845 and welcome to the community!

If you use something like this, you should be able to get that data:

{
  items(ids: 1234567890) {
    name
    id
    column_values {
      text
      value
    }
  }
}

Take into account that some specific column types might require a different syntax. You can check how to get any column data here :smile:

Matias,

Thanks! I actually figured out what I needed on this and couldn’t see a way to remove my post as it was still pending.

What I’m REALLY needing to know now is how to post a mutation query where I can create an item that includes a column value that is a pulse id column reference to another item on another board. I’m trying to make sure I have this in place so I can finish writing my integration for one of our systems I’m transitioning us from and really need to be able to create items that will have the right references in those columns.

For example, in this case, I’ve done a full import of our accounts into the crm side, but I’m wanting to tie our Contact records to the accounts as they are and I’ve got our source platform record id in as a column on the account board.

I’m reading a source contact file and then querying for the right item id from the account board based on that source platform id and it’s returning properly.

I’ve got absolutely everything working except the mutation. It looks like it tries to do it when I run my code, outputs the insert, but the insert is blank on the pulse id column still.

I’ve validated that the mutation is actually working though. It creates a new one any time I run it…so…

If you can help me with the best way to get the pulse id column reference to actually work, that would be awesome.

Thanks!

Hello again!

If I understand correctly, the item is created but without the value for that column.

Can you please send over the full mutation you are using? You can change the values a bit so that we don’t get the actual data you are using.

Looking forward to hearing from you!

Cheers,
Matias

Matias,

No problem. I’ve tried a lot of different variations and just can’t seem to get it to work.

Here’s an example.

mutation {
create_item (board_id: our_board_id, group_id: “topics”, item_name: “’ . $fullname . '”, column_values: “{"linkedPulseIds": {"linkedPulseId": "’ . $mondayid . '"}}”)
}

I’ve also tried to do it by column name (the linked column id is called contact_account), but I couldn’t get that to work.

Thanks!

Hello again @netadmin_cf8594845,

Would you be able to please try something like this:

mutation {create_item (board_id: our_board_id, group_id: "topics", item_name: "" . $fullname . "", column_values: "{\"YOURCONNECTBOARDSCOLUMNIDHERE\" : {\"item_ids\" : [\"THEIDOFTHEITEMTOCONNECTTOHERE\"]}}")
}

Let me know how that goes!

Cheers,
Matias

Matias,

I figured out what was wrong with my mutation. I had originally had the {id} in my original query from the docs but had removed it and once i added it back in, my queries are inserting just fine.

I do have one more question.

I’m curious if there is a particular way I need to escape and/or handle an email string for an email type column. I tried to include that in my new query and it’s not working with same escaping as the other fields. I can run the query with everything except the email string insert and it works fine. Is there something special I need to do with it to be accepted in the query?

Thanks!

Hello again @netadmin_cf8594845,

Can you please share the mutation that is failing with the email value you are using?

Sure.

Looks like the forum is removing the escaping for whatever reason when I paste, but this is the essense of what I tried.

mutation {
create_item (board_id: our_board_id, group_id: “topics”, item_name: “’ . $fullname . '”, column_values: “{"status": "Partner","text__1":"928 Santa Fe Street","text6__1":"’ . $mailingcity . ‘","text2__1":"’ . $mailingstate . ‘","text0__1":"’ . $mailingzip . ‘","contact_email": {"email":"’ . $email . ‘","text":"’ . $email . ‘","contact_account" : {"item_ids" : ["’ . $mondayid . '"]}}”)
{id}
}

Hello again @netadmin_cf8594845,

GraphQL wise, this syntax should work for you:

In a JSON this would look something like this:

I hope that helps!

Cheers,
Matias