0

I am using the Podio PHP API. I am trying to get the item id from a newly created item. Unfortunately, it appears that the item_id is blank/null. I am not sure where I am going wrong. Here is my code:

$create = PodioItem::create(#####, array('title' => $_POST['title'], 'fields' => array(
  "project-title" => $_POST['title'],
  "status" => "1st Status"
)));

$theitemid = $create->item_id;
print $theitemid;

The item is inserted into Podio without a problem, but every time I try to print $create->item_id or insert it into a separate mysql database, it turns up as empty/null.

Anyone know where I am going wrong?

Alex
  • 196
  • 5
  • 22

1 Answers1

1

On March 6 PodioItem::create changed from returning an integer (the item_id) to returning a PodioItem object. I'm guessing you have pre-March 6th version of podio-php and thus $create is holding just an integer.

Reference: https://github.com/podio/podio-php/commit/f7a4342179da40b2566b60aec45b9a282bffe1de

  • Ah, you are right. I re-downloaded it from Github and now half of my code no longer works. Looks like I do have the Pre-March 6th version. Do you know of any way to get the item_id wit the pre-march 6th version? – Alex May 19 '14 at 22:56
  • $theitemid = PodioItem::create(#####, array('title' => $_POST['title'], 'fields' => array( "project-title" => $_POST['title'], "status" => "1st Status" ))); – Andreas Haugstrup Pedersen May 20 '14 at 13:10
  • As far as I am aware, this creates a new item in Podio. I am asking how I would be able to get the ITEM ID for this new item as soon as it is created. – Alex May 20 '14 at 16:24
  • In Andreas' example above, $theitemid holds the item id of the newly-created item. – LP Papillon May 28 '14 at 19:53