Interface ReportResources


  • public interface ReportResources

    This interface provides methods to access Report resources.

    Thread Safety: Implementation of this interface must be thread safe.

    • Method Detail

      • getReport

        Report getReport​(long reportId,
                         java.util.EnumSet<ReportInclusion> includes,
                         java.lang.Integer pageSize,
                         java.lang.Integer page)
                  throws SmartsheetException

        Get a report.

        It mirrors to the following Smartsheet REST API method: GET /report/{reportId}

        Parameters:
        reportId - the reportId of the report
        includes - used To specify the optional objects to include.
        pageSize - page size parameter for pagination
        page - page parameter for pagination
        Returns:
        the report (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null)
        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
      • getReport

        Report getReport​(long reportId,
                         java.util.EnumSet<ReportInclusion> includes,
                         java.lang.Integer pageSize,
                         java.lang.Integer page,
                         java.lang.Integer level)
                  throws SmartsheetException

        Get a report.

        It mirrors to the following Smartsheet REST API method: GET /report/{reportId}

        Parameters:
        reportId - the reportId of the report
        includes - used To specify the optional objects to include.
        pageSize - page size parameter for pagination
        page - page parameter for pagination
        level - compatibility level
        Returns:
        the report (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null)
        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
      • sendReport

        void sendReport​(long reportId,
                        SheetEmail email)
                 throws SmartsheetException

        Send a sheet as a PDF attachment via Email To the designated recipients.

        It mirrors to the following Smartsheet REST API method: POST /reports/{reportId}/emails

        Parameters:
        reportId - the reportId of the report
        email - email of designated recipient.
        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
      • listReports

        PagedResult<Report> listReports​(PaginationParameters parameters,
                                        java.util.Date modifiedSince)
                                 throws SmartsheetException

        List all reports.

        It mirrors to the following Smartsheet REST API method: GET /reports

        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) - 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:
        parameters - pagination parameters for paging result
        modifiedSince - restrict results to sheets modified on or after this date
        Returns:
        all sheets (note that empty list will be returned if there is none)
        Throws:
        SmartsheetException - the smartsheet exception
      • listReports

        PagedResult<Report> listReports​(PaginationParameters parameters)
                                 throws SmartsheetException

        List all reports.

        It mirrors to the following Smartsheet REST API method: GET /reports

        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) - 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:
        parameters - pagination parameters for paging result
        Returns:
        all sheets (note that empty list will be returned if there is none)
        Throws:
        SmartsheetException - the smartsheet exception
      • getReportAsExcel

        void getReportAsExcel​(long id,
                              java.io.OutputStream outputStream)
                       throws SmartsheetException

        Get a Report as an excel file.

        It mirrors to the following Smartsheet REST API method: GET /reports/{id} with "application/vnd.ms-excel" Accept HTTP header

        Exceptions: IllegalArgumentException : if outputStream is null 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:
        id - the id
        outputStream - the OutputStream to which the Excel file will be written
        Throws:
        SmartsheetException - the smartsheet exception
      • getReportAsCsv

        void getReportAsCsv​(long id,
                            java.io.OutputStream outputStream)
                     throws SmartsheetException

        Get a Report as an csv file.

        It mirrors to the following Smartsheet REST API method: GET /reports/{id} with "application/vnd.ms-excel" Accept HTTP header

        Exceptions: IllegalArgumentException : if outputStream is null 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:
        id - the id
        outputStream - the OutputStream to which the Excel file will be written
        Throws:
        SmartsheetException - the smartsheet exception
      • getPublishStatus

        ReportPublish getPublishStatus​(long id)
                                throws SmartsheetException

        Get the publish status of a report.

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

        Parameters:
        id - the ID of the report
        Returns:
        the report publish status (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null).
        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
      • updatePublishStatus

        ReportPublish updatePublishStatus​(long id,
                                          ReportPublish reportPublish)
                                   throws SmartsheetException

        Sets the publish status of a report and returns the new status, including the URLs of any enabled publishing.

        It mirrors to the following Smartsheet REST API method: PUT /reports/{id}/publish

        Parameters:
        id - the ID of the report
        reportPublish - the ReportPublish object
        Returns:
        the updated ReportPublish (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null)
        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
      • updateReportDefinition

        void updateReportDefinition​(long id,
                                    ReportDefinition reportDefinition)
                             throws SmartsheetException

        Updates a report's definition (filters, grouping, summarize, and sorting).

        It mirrors to the following Smartsheet REST API method: PUT /reports/{id}/definition

        This endpoint supports partial updates only on root level properties of the report definition, such as filters, groupingCriteria, and summarizingCriteria. For example, you can update the report's filters without affecting its grouping criteria. However, nested properties within these objects, such as a specific filter or grouping criterion, cannot be updated individually and require a full replacement of the respective section.

        Parameters:
        id - the ID of the report
        reportDefinition - the ReportDefinition object containing the updated definition
        Throws:
        java.lang.IllegalArgumentException - if any argument is null
        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
      • shareResources

        ShareResources shareResources()

        Creates an object of ShareResources.

        Returns:
        the created ShareResources object
      • deleteReport

        void deleteReport​(long id)
                   throws SmartsheetException

        Deletes a report.

        Mirrors the following Smartsheet REST API method: DELETE /reports/{reportId}

        Parameters:
        id - the id of the report
        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
      • addReportScope

        void addReportScope​(long id,
                            java.util.List<ReportScopeInclusion> scopes)
                     throws SmartsheetException

        Adds one or more specified sheet or workspace to the report scope.

        Parameters:
        id - the ID of the report
        scopes - A list of one or more objects denoting the sheets or workspaces associated with the report to be added to the report scope.
        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
      • removeReportScope

        void removeReportScope​(long id,
                               java.util.List<ReportScopeInclusion> scopes)
                        throws SmartsheetException

        Removes one or more specified sheet or workspace from the report scope.

        Parameters:
        id - the ID of the report
        scopes - A list of one or more objects denoting the sheets or workspaces associated with the report to be removed from the report scope.
        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
      • addReportColumns

        java.util.List<ReportColumn> addReportColumns​(long reportId,
                                                      java.util.List<ReportColumn> reportColumns)
                                               throws SmartsheetException

        Add columns to a report.

        It mirrors to the following Smartsheet REST API method: POST /reports/{reportId}/columns

        Note: All indexes of the columns must be equal.

        Parameters:
        reportId - the ID of the report
        reportColumns - the list of columns to add (must contain 1-400 items)
        Returns:
        the list of columns that were added
        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
      • createReport

        CreateReportResult createReport​(CreateReportRequest request)
                                 throws SmartsheetException

        Create a new report.

        It mirrors to the following Smartsheet REST API method: POST /reports

        Creates a new report by specifying name, destination, scope, columns and definition.

        Parameters:
        request - the CreateReportRequest containing report specifications
        Returns:
        the CreateReportResult containing the newly created report information
        Throws:
        java.lang.IllegalArgumentException - if any argument is null
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation