Comments

13 comments

  • Casper Fabricius

    We have a lot of java samples at https://github.com/podio, but I just went through them and ironically they all seem to be creating items, not reading items.

    Even if it's not exactly what you asked for, perhaps these samples will be able to help you:

    https://github.com/podio/sample-alerts/blob/master/src/main/java/com/podio/sample/alert/AlertWriter.java

    https://github.com/podio/sample-dropbox/blob/master/src/main/java/com/podio/sample/dropbox/FileScanner.java

    https://github.com/podio/sample-zendesk/blob/master/src/main/java/com/podio/sample/zendesk/Importer.java

    0
    Comment actions Permalink
  • Jeroen Tip

    I have reed the code alredy however this is al getting items by external id

    I am trying to use the following code 

        ItemsResponse items =  itemAPI.getItems(1663074, 20, 0, null, true, null);

    getting errors with this one.

    I just need a simple list of items in the application with there ID is there another way to get them ?

    0
    Comment actions Permalink
  • Christian Holm

    What is the error you get?

    0
    Comment actions Permalink
  • Jeroen Tip

    this is the exeption

    start ITEM

    c1connect

    i1Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    at com.podio.item.ItemAPI.getItems(ItemAPI.java:281)

    at nl.docuproces.addpodiolink.Podioconnect.getItems(Podioconnect.java:135)

    at nl.docuproces.addpodiolink.Cache.cache_dpItem(Cache.java:108)

    at nl.docuproces.addpodiolink.SelectPodioItem$5.itemStateChanged(SelectPodioItem.java:297)

    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1225)

    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1282)

    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1329)

    at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:118)

    at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:94)

    at javax.swing.JComboBox.setSelectedItem(JComboBox.java:578)

    at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:624)

    at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:835)

    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)

    at java.awt.Component.processMouseEvent(Component.java:6505)

    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)

    at com.apple.laf.AquaComboBoxPopup$1.processMouseEvent(AquaComboBoxPopup.java:157)

    at java.awt.Component.processEvent(Component.java:6270)

    at java.awt.Container.processEvent(Container.java:2229)

    at java.awt.Component.dispatchEventImpl(Component.java:4861)

    at java.awt.Container.dispatchEventImpl(Container.java:2287)

    at java.awt.Component.dispatchEvent(Component.java:4687)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)

    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)

    at java.awt.Container.dispatchEventImpl(Container.java:2273)

    at java.awt.Window.dispatchEventImpl(Window.java:2719)

    at java.awt.Component.dispatchEvent(Component.java:4687)

    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)

    at java.awt.EventQueue.access$000(EventQueue.java:102)

    at java.awt.EventQueue$3.run(EventQueue.java:662)

    at java.awt.EventQueue$3.run(EventQueue.java:660)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)

    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)

    at java.awt.EventQueue$4.run(EventQueue.java:676)

    at java.awt.EventQueue$4.run(EventQueue.java:674)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)

    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)

    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

    0
    Comment actions Permalink
  • Christian Holm

    The last argument of the getItems method is varargs that is used for filtering. "null" is not a valid filter, so it fails. Simply remove the last argument, and it will work. If you want to do filtering, you need to look at the filter classes: https://github.com/podio/podio-java/tree/master/src/main/java/com/podio/filter. They are used for the varargs argument.

    0
    Comment actions Permalink
  • Rich Stoldt

    So this should work?

    ItemsResponse items = itemAPI.getItems(2100929, 100, 0, null, false);

    I get this exception

    Exception in thread "main" APIException [status=Bad Request, error=invalid_value, description=Invalid value 0: Must not be less than 1 (at limit), parameters=null]

        at com.podio.ExceptionFilter.handle(ExceptionFilter.java:27)

        at com.sun.jersey.api.client.Client.handle(Client.java:648)

        at com.podio.LoginFilter.handle(LoginFilter.java:28)

        at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)

        at com.sun.jersey.api.client.WebResource.get(WebResource.java:191)

        at com.podio.item.ItemAPI.getItems(ItemAPI.java:285)

        at def.start.main(start.java:34)

    0
    Comment actions Permalink
  • Christian Holm

    The error message is from the API saying the limit was set to 0. However from your code the limit should be set to 100. Are you sure your code is exactly like that? 

    0
    Comment actions Permalink
  • Rich Stoldt

    Yes - that was copied and pasted directly from the code

    0
    Comment actions Permalink
  • Rich Stoldt

    Oops - never mind ... apparently Eclipse doesn't save the file prior to running.  Any example on how to iterate through the ItemsResponse object?

    0
    Comment actions Permalink
  • Rich Stoldt

    Another never mind - I figured it out.  Thanks all.

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Could you share the solution here so people coming back at a later date can see what was going on?

    0
    Comment actions Permalink
  • Rich Stoldt

    Certainly - I'm just a bit shy since I'm such a noob .... I'll throw in iterating the fields as a bonus :)

    Perhaps you might demonstrate a filter for the getItems method in return.

            ItemAPI itemAPI = apiFactory.getAPI(ItemAPI.class);

            ItemsResponse response = itemAPI.getItems(2100929, 100, 0, null, false);

            System.out.println(response.toString());

            List<ItemBadge> items = response.getItems();

            for (ItemBadge item : items)

            {

                List<FieldValuesView> fields = item.getFields();

                for (FieldValuesView field : fields)

                {

                    System.out.println(field.getLabel().toString());

                    System.out.println(field.getValues().toString());

                }

            }

    0
    Comment actions Permalink
  • Deepak R Babu
    ItemsResponse response = itemAPI.getItems(podioAppId, 100, 0, null, false);

    When i execute the this code i got the following exception. Does anybody knows whats the problem. What exactly are the inside parameters ?

    com.sun.jersey.api.client.ClientHandlerException: org.codehaus.jackson.map.JsonMappingException: No enum constant com.podio.app.ApplicationFieldType.PHONE (through reference chain: com.podio.item.ItemsResponse["items"]->com.podio.item.ItemBadge["fields"]->com.podio.item.FieldValuesView["type"])
    at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:644)
    at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:586)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:686)
    at com.sun.jersey.api.client.WebResource.get(WebResource.java:193)
    at com.podio.item.ItemAPI.getItems(ItemAPI.java:294)

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk