smartsheet-apismartsheet-java-sdk-v2smartsheet-java-sdk-v1smartsheet-api-2.0

Smart Sheet API 2.1.1, Download attachment but url is missing


Download attachement to Local drive ##

        for(Row r : rows){

        PagedResult<Attachment> attachments = smartsheet.sheetResources().rowResources().attachmentResources().getAttachments(sheetId, r.getId(), null);


        System.out.println("attachments"+attachments.getData().size());


        if(attachments.getData().size() > 0){

        for(Attachment at : attachments.getData()){

                      System.out.println(String.format("Attachement ID[%s], URL{%s}",at.getId(),at.getUrl()));

        }

Output::


Solution

  • I understand now, iterating the object and reaching out the attachement will not give you the url, infact you have to get id from that object and then query smart sheet again with GetAttachment procedure i. e

      Attachment at = smartsheet.sheetResources().attachmentResources().getAttachment(sheetId, att.getId());