Interface SheetAttachmentResources


  • public interface SheetAttachmentResources
    • Method Detail

      • attachUrl

        Attachment attachUrl​(long sheetId,
                             Attachment attachment)
                      throws SmartsheetException

        Attach a URL to a sheet.

        The URL can be a normal URL (attachmentType "URL"), a Google Drive URL (attachmentType "GOOGLE_DRIVE") or a Box.com URL (attachmentType "BOX_COM").

        It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/attachments

        Parameters:
        sheetId - the sheet id
        attachment - the attachment object
        Returns:
        the attachment object
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • deleteAttachment

        void deleteAttachment​(long sheetId,
                              long attachmentId)
                       throws SmartsheetException

        Delete an attachment.

        It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/attachments/{attachmentId}

        Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation

        Parameters:
        sheetId - the ID of the sheet
        attachmentId - the ID of the attachment
        Throws:
        SmartsheetException - the smartsheet exception
      • getAttachment

        Attachment getAttachment​(long sheetId,
                                 long attachmentId)
                          throws SmartsheetException

        Get an attachment.

        It mirrors to the following Smartsheet REST API method: GET /attachment/{id}

        Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation

        Parameters:
        sheetId - the sheet id
        attachmentId - the attachment id
        Returns:
        the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null).
        Throws:
        SmartsheetException - the smartsheet exception
      • listAttachments

        PagedResult<Attachment> listAttachments​(long sheetId,
                                                PaginationParameters parameters)
                                         throws SmartsheetException

        Gets a list of all Attachments that are on the Sheet, including Sheet, Row, and Discussion level Attachments.

        It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/attachments

        Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation

        Parameters:
        sheetId - the ID of the sheet to which the attachments are associated
        parameters - the pagination parameters
        Returns:
        the attachments (note that empty list will be returned if there is none)
        Throws:
        SmartsheetException - the smartsheet exception
      • attachFile

        Attachment attachFile​(long sheetId,
                              java.io.File file,
                              java.lang.String contentType)
                       throws java.io.FileNotFoundException,
                              SmartsheetException

        Attach a file to a sheet with simple upload.

        It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/attachments

        Parameters:
        sheetId - the id of the sheet
        file - the file to attach
        contentType - the content type of the file
        Returns:
        the created attachment
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • attachFile

        Attachment attachFile​(long sheetId,
                              java.io.InputStream inputStream,
                              java.lang.String contentType,
                              long contentLength,
                              java.lang.String attachmentName)
                       throws SmartsheetException

        Attach file for simple upload.

        Parameters:
        sheetId - the sheet id
        inputStream - attachment data inputStream
        contentType - the content type
        contentLength - the content length
        attachmentName - the name of the attachment
        Returns:
        the attachment
        Throws:
        SmartsheetException - the smartsheet exception