Attach files to Item with Java API
Hey! New to this API, and are having a hard time attaching a file to an already existing item, and also having problem finding any documentation for this for Java. Code example: @Test public void insertNewItemAndAttachFileTest() { ItemCreate item; List<FieldValuesUpdate> list; list = new ArrayList<FieldValuesUpdate>(); list.add(new FieldValuesUpdate("title","value","Test-Title")); list.add(new FieldValuesUpdate("id","value","999")); list.add(new FieldValuesUpdate("idextern","value","FILETEST")); item = new ItemCreate("externalId", list, Collections.<Integer> emptyList(), Collections.<String> emptyList()); int id = itemApi.addItem(appID, item, false); Assert.assertTrue(id > 1); int fileId = fileApi.uploadFile("test.pdf", new File("test/assets/test.pdf")); com.podio.file.File file = fileApi.getFile(fileId); List<com.podio.file.File> files = new ArrayList<>(); files.add(file); Item insertedItem = itemApi.getItem(id); } Can someone point out what I'm doing wrong? Thanks a million in advance!

  • I'm by no means a java guy, but appears to me that you save the item and then attach a file to the item object. I'm guessing you want to save again after adding the files (or even better wait on saving until after you've attached the files)
  • Hi Andreas. There is no error message, while debugging the Item in question got the file attached. All though, its not showing up in the view. Is there anything else that I need to do for this? Saw now that my first question was a bit misleading..
This question is closed.