URGENT problem with Podio API today

Answered

Comments

39 comments

  • Andreas Haugstrup Pedersen

    Hi Patrick,

    I can infer that you are looking at an item URL to get the item_id. With the unique ID feature the item URLs changed to use the unique ID rather than the item_id. That's why the ID is only 3 digits now.

    So you have two options:

    1. Stop looking at the URL to get the item_id and locate it some other way (I'm not sure why you need to look at the URL so it's hard to suggest changes)
    2. Use this API operation to get the item by the unique id (called app_item_id in API lingo). You'll need to supply an app_id as well since the unique IDs are only unique within an app so we need to know for which app you are getting items: https://developers.podio.com/doc/items/get-item-by-app-item-id-66506688

    Makes sense?

    /Andreas

    0
    Comment actions Permalink
  • Tyra Steil

    In some cases we have to use the item_id from the URL since the user may access our tool via a Bookmarklet and we simply get the URL of the "item" which includes the item_id... 

    I never heard of "app_item_id"... is that new?

    This was a big change, would have been good to get advance notice of this... 

    Patrick

     

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    It's new as of this morning: http://blog.podio.com/2013/08/05/uniqueid/

    You can get the app by URL label: https://developers.podio.com/doc/applications/get-app-on-space-by-url-label-477105

    All the best,

    Andreas

    0
    Comment actions Permalink
  • Tyra Steil

    So is there a new commit to the API we need to download also?

    How can I get the unique ID (app_item_id) from the "item_id"?  I need an API call for that also... 

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    I just added app_item_id and app_id_id_formatted properties to the item model: https://github.com/podio/podio-php/commit/14dbd8649bf2f4910d58498ba64634cc2f2e4613

    And, yes, you need to download the newest version of podio-php get get the newest code :)

    /Andreas

    PS. You're logged in as Tyra :)

    0
    Comment actions Permalink
  • Tyra Steil

    I am logged in as Tyra because the Forums code logs me out every time I post!  :)

    Thanks for adding this... this should have been announced to API developers and Podio Preferred Partners... 

    0
    Comment actions Permalink
  • Tyra Steil

    Since items created before today still have the "unique id" in the url string, how can I tell the difference between these and the new ones besides looking at the value / size of the id?

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    All item views use the new app_item_id in the URL, no matter if the Unique ID is turned on for that app, so if someone is on an item view they are seeing the app_item_id in the URL. There are a few places that still use the item_id in the URL (e.g. the print item view). We'll change those over to use app_item_id over time.

    0
    Comment actions Permalink
  • Tyra Steil

    Ah, its actually my old links that we recorded in the comments that have the old unique id... thanks... 

    0
    Comment actions Permalink
  • Tyra Steil

    How can I get the uniqueID for the item from the app_item_id?  I desperately need that or I am going to have to rewrite a lot of code and my system is basically down until I can do all that... 

    0
    Comment actions Permalink
  • Tyra Steil

    Oh I guess I can get that from PodioItem::get_by_app_item_id... never mind... 

    0
    Comment actions Permalink
  • Tyra Steil

    Previously with the getitem(uniqueid) approach I could easily get the item and the app id... and I didn't need the spaceid...

    Now, I am having to get the appid to get the itemid

    But to get the appid by using PodioApp::get_for_url( $space_id, $url_label ), I also need the spaceid... so then I need to make another api call to get the spaceid...

    Is there a better way to do this?

    I REALLY need an API like:

    $item = getItemFromAppItemURL( $url )

    So just pass in the entire URL and it returns me the item... 

    Can we get this?

    0
    Comment actions Permalink
  • Tyra Steil

    Andreas, any chance of this?

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    The Podio API and the podio web frontend are two separate entities and for that reason we try not to have them be dependent of each other. It's why we only have the bare minimum of "get by URL" operations in the API (the URLs in the frontend doesn't really have anything to do with the API).

    Space URLs hardly ever change (And when they do it's something the user does manually) so you can cache those hard. App URL slugs can change when an app is modified so you can cache those hard and use a webhook to invalidate your cache whenever the app is modified. Overall there shouldn't be any noticeable performance impact for your users.

    /Andreas

    0
    Comment actions Permalink
  • Tyra Steil

    I do not agree... remember we are making the API calls from half way around the world... so at some point we have to make those api calls and they are not cheap... we do a lot of caching already... but this just adds to our app complexity...

    And now with this change that I am trying to solve quickly I am having to write a bunch of new code I didn't need before because there is not an easy way to get back to the way it worked before... this would go very far in making the api much more developer friendly!

    Pretty please, can we have an API call like: 

    $item = getItemFromAppItemURL( $url )

    Is this very hard on your end to create?

     

    0
    Comment actions Permalink
  • Tyra Steil

    And please keep in mind... we don't just have ONE workspace and App we are dealing with (that we would need to cache), we have hundreds and eventually thousands... so this is not the most scalable thing to have in place... it would be so much better to have these types of helper functions so we don't have to get the spaceid, appid just to get to the item... (when we already know the URL of the item)... 

    0
    Comment actions Permalink
  • Tyra Steil

    I am trying to follow your original suggestion:

    1. Use this API operation to get the item by the unique id (called app_item_id in API lingo). You'll need to supply an app_id as well since the unique IDs are only unique within an app so we need to know for which app you are getting items:  https://developers.podio.com/doc/items/get-item-by-app-item-id-6650...

    But in order to get the app_id, I have to call something like 

    PodioSpace::get_for_url( $appURL )

    But I don't have the URL to the app at this point in my code, all I have is the url to the item... so should I get the spaceid so I can get the appid then?

     

    0
    Comment actions Permalink
  • Tyra Steil

    I was able to use the api reference to test getting the space by using the item's url... that worked...

    But when I tried to get the app by URL using the item's url that did not work... 

    0
    Comment actions Permalink
  • Tyra Steil

    I got this error when I called

    PodioSpace::get_for_url( $attributes = array() );

     

    {"error_parameters"=>{}, "error_detail"=>nil, "error_propagate"=>false, "request"=>{"url"=>"http://api.podio.com/app/space/264135/https:/infranetcom.podio.com/web-content-team/apps/cb-projects/items/5413", "query_string"=>"type=full", "body"=>nil, "method"=>"GET"}, "error_description"=>"No matching operation could be found. The path '/app/space/264135/https:/infranetcom.podio.com/web-content-team/apps/cb-projects/items/5413' was not found..", "error"=>"not_found"}

    0
    Comment actions Permalink
  • Tyra Steil

    Here is a video showing you what happened as I mentioned in the last 2 comments... 

    http://screencast.com/t/Lp78kWa2mC3l

    0
    Comment actions Permalink
  • Christian Holm

    Hi Tyra

    This method expects to get the "URL label" also known as the "slug". In this case it would be "cb-projects". So the full request would be f.ex. 

    http://api.podio.com/app/space/264135/cb-projects

    Alternatively you can also use this method:

    https://developers.podio.com/doc/reference/resolve-url-66839423

    by simply giving it the full URL for the item. Something like:

    https://api.podio.com/reference/resolve?url=https:/infranetcom.podio.com/web-content-team/apps/cb-projects/items/5413

    Notice that the parameter should be URL encoded (most likely done automatically).

    This will give you back an object describing the type and id of the item, which you can then use to get the item.

    Hope this helps,

    Christian 

    0
    Comment actions Permalink
  • Tyra Steil

    Christian, thanks... "Tyra" is me - Patrick... my ID won't work on the forums today... logs me out every time I try to do something... 

    I'll try that... not sure why this "slug" thing isn't better documented... 

     

    0
    Comment actions Permalink
  • Tyra Steil

    What are the chances of getting an API call would be used like this:

    $item = getItemFromAppItemURL( $url )

    where $url is something like:

    https://podiohelpdeskcom.podio.com/podiohelpdeskcom-app-data/apps/regression-tests/items/462

     

    0
    Comment actions Permalink
  • Christian Holm

    That is of course a possibility, but it does become a little much, as we would then need versions of many API methods, to get by URL. I think the second method I gave you does the job quite nicely, although it does require multiple API calls. Can you give it a try as it should be quite easy to use. I can try to get Andreas to add it to the PHP client.

    0
    Comment actions Permalink
  • Tyra Steil

    Or at this point, just having the 

    PodioApp::get_for_url

    call be able to handle the new URLs to the app items just like the space:get_for_url supports would be great too... 

    and a lot easier for you probably... 

     

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Hey Patrick,

    I think you have two good options for your use case:

    1. Since you are using a browser extension you can get the context data from the javascript layer. Try going to an item view in Podio and running the following in your javascript console: require('lib/Podio.UI').context(); That'll give you the current page context.
    2. Using the API operation Christian linked to might be more familiar to you. I've added the method in podio-php here: https://github.com/podio/podio-php/commit/e2b2a404b8f77518a6451961762f87e9e5f614bc

    Since the operation returns all kinds of data you may not even have to subsequently use PodioItem::get() as you can create a new PodioItem object like so:

    $reference = PodioReference::resolve(array('url' => 'https://podiohelpdeskcom.podio.com/podiohelpdeskcom-app-data/apps/regression-tests/items/462'));

    $item = new PodioItem($reference->data);

    Makes sense?

    /Andreas

    0
    Comment actions Permalink
  • Tyra Steil

    Andreas, thanks!  That may help alot!

    0
    Comment actions Permalink
  • Tyra Steil

    Ok, I was able to add your new ::resolve function and that worked great and was super easy, thanks!

    So next problem... 

    We use this code:

    $results = PodioSearchResult::app( $config_app_id, $attributes );

    to search through our "config" app for the item_id of a configured PodioTools app... 

    I verified that I can search that "config" app manually using the Podio UI, but in my code, it is returning zero results where this has been working fine for months...  

    Can you look into this, thanks!

    0
    Comment actions Permalink
  • Tyra Steil

    Ignore this last issue... :)  Thanks... 

    0
    Comment actions Permalink
  • Tyra Steil

    Ok, all is well again now guys, thanks!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk