Getting data from the API Call

Answered

Comments

4 comments

  • Andreas Haugstrup Pedersen

    Hi Jon,

    PodioItem::filter_by_view() doesn't return a string. podio-php does a lot of work for you under the hood. What you get is an array with three properties: filtered and total which contains the filtered and total counts and then "items".

    "items" is an array of PodioItem objects. Podio items are rather complex sizes and it can quickly become complicated to work with the raw data. So podio-php has a nice class for the purpose (actually almost all methods return some form of object rather than plain hashes).

    Some examples of what you can do with PodioItem objects (and the related fields): https://github.com/podio/podio-php/blob/master/examples/items.php

    /Andreas

    0
    Comment actions Permalink
  • Jon Hatto

    Thanks Andreas, I'm trying to follow the example, but it still doesn't seem to work:

    $itemsarray = PodioItem::filter_by_view($app_id,$view_id);

    if (is_array($itemsarray)) {

    foreach($itemsarray as $items) {

    if (is_array($items)) {

    foreach($items as $item) {

    echo $item->title;

    echo $item->due;

    }

    }

    }

    }

     

    This prints out the title, but not the due date.

    0
    Comment actions Permalink
  • Jon Hatto

    Also, this prints the title, but not the due date:

    $item_collection = PodioItem::filter_by_view($app_id,$view_id);

    foreach($item_collection['items'] as $object) {

    foreach($object as $item) {

    echo $item['title'];

    echo $item['due'];

    }

    }

    0
    Comment actions Permalink
  • Jon Hatto

    Got it figured out - humanized_value is my friend :)

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk