1

When a Webhook is triggered, is there a way to get the org_id from which it was fired? (Aside from climbing up the triggered item)

The only solution I found so far is:

  1. PodioItem::get($item_id); to get the space_id
  2. PodioSpace::get($space_id); to get the full
  3. PodioOrganization::get_for_url($attributes = array()); I get the org_id.
Vincent Poirier
  • 4,298
  • 5
  • 21
  • 25

2 Answers2

1

See the "Bundling responses using fields parameter" section at the very bottom of https://developers.podio.com/index/api on how you can use the fields query parameter to include more data. There's even an example that goes almost all the way for you (it walks up to the space level, but you can just tack the org onto it):

/item/{item_id}?fields=app.view(full).fields(space.view(full))

For podio-php you can do:

$item = PodioItem::get($item_id, array('fields' => "app.view(full).fields(space.view(full))"));
  • Do I change `{item_id}` by the actual item_id like this? `{1112223333}`. I tried without the `fields` paramater, with it like your exemple and finally the same thing but with the replaced id. It all returned the same thing, the item by itself. Is it a good practice to put coding in the comment or I should edit my question with the attempts? – Vincent Poirier Oct 18 '14 at 16:45
  • My second example was a complete copy/paste error, should be better now – Andreas Haugstrup Pedersen Oct 19 '14 at 04:39
  • It doesn't seem to work still. Here's the code I'm trying: http://oi61.tinypic.com/24erel3.jpg Both output files are the very same size and do not explicitely provide any org_id (through a space object). – Vincent Poirier Oct 27 '14 at 23:19
0

Use PodioItem::filter instead of PodioItem::get, I'm pretty sure that you'll have the expected results, so try this: $item = PodioItem::filter($item_id, array('filters' => "app.view(full).fields(space.view(full))"));

Hope it helps!

Mathieu Smith
  • 378
  • 1
  • 13