Class BulkAPI

java.lang.Object
com.zoho.analytics.client.BulkAPI

public class BulkAPI extends Object
BulkAPI contains bulk data operation.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BulkAPI(AnalyticsClient ac, long orgId, long workspaceId)
    Creates a new BulkAPI instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    exportBulkData(long jobId, OutputStream stream)
    Download the exported data for the mentioned job id.
    void
    exportBulkData(long jobId, String filePath)
    Download the exported data for the mentioned job id.
    void
    exportData(long viewId, String responseFormat, OutputStream stream, org.json.JSONObject config)
    Export the mentioned table (or) view data.
    void
    exportData(long viewId, String responseFormat, String filePath, org.json.JSONObject config)
    Export the mentioned table (or) view data.
    void
    exportDataUsingSQL(String sqlQuery, String responseFormat, OutputStream stream, org.json.JSONObject config)
    Internally used in JDBC driver
    void
    exportDataUsingSQL(String sqlQuery, String responseFormat, String filePath, org.json.JSONObject config)
    Internally used in JDBC driver
    org.json.JSONObject
    getExportJobDetails(long jobId)
    Returns the details of the export job.
    org.json.JSONObject
    getImportJobDetails(long jobId)
    Returns the details of the import job.
    org.json.JSONObject
    handleCustomBatchImport(long viewId, String filePath, org.json.JSONObject config)
     
    long
    importBulkData(long viewId, String importType, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config)
    Asynchronously import the data contained in the mentioned file into the table.
    long
    importBulkDataInNewTable(String tableName, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config)
    Asynchronously create a new table and import the data contained in the mentioned file into the created table.
    org.json.JSONObject
    importData(long viewId, String importType, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config)
    Import the data contained in the mentioned file into the table.
    long
    importDataAsBatches(long viewId, String importType, boolean autoIdentify, String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig)
    Asynchronously import the data contained in the mentioned file into the table.
    org.json.JSONObject
    importDataInNewTable(String tableName, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config)
    Create a new table and import the data contained in the mentioned file into the created table.
    long
    importDataInNewTableAsBatches(String tableName, boolean autoIdentify, String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig)
    Create a new table and import the data contained in the mentioned file into the created table.
    org.json.JSONObject
    importRawData(long viewId, String importType, String fileType, boolean autoIdentify, String data, org.json.JSONObject config)
    Import the raw data provided into the table.
    org.json.JSONObject
    importRawDataInNewTable(String tableName, String fileType, boolean autoIdentify, String data, org.json.JSONObject config)
    Create a new table and import the raw data provided into the created table.
    long
    initiateBulkExport(long viewId, String responseFormat, org.json.JSONObject config)
    Initiate asynchronous export for the mentioned table (or) view data.
    long
    initiateBulkExportUsingSQL(String sqlQuery, String responseFormat, org.json.JSONObject config)
    Initiate asynchronous export with the given SQL Query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BulkAPI

      protected BulkAPI(AnalyticsClient ac, long orgId, long workspaceId)
      Creates a new BulkAPI instance.
      Parameters:
      ac - AnalyticsClient instance.
      orgId - The ID of the organization.
      workspaceId - The ID of the workspace.
  • Method Details

    • importDataInNewTable

      public org.json.JSONObject importDataInNewTable(String tableName, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Create a new table and import the data contained in the mentioned file into the created table.
      Parameters:
      tableName - Name of the new table to be created.
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A JSONObject of import result.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importData

      public org.json.JSONObject importData(long viewId, String importType, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Import the data contained in the mentioned file into the table.
      Parameters:
      viewId - Id of the view where the data to be imported.
      importType - The type of import. Can be one of
      • append
      • truncateadd
      • updateadd
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A JSONObject of import result.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importRawDataInNewTable

      public org.json.JSONObject importRawDataInNewTable(String tableName, String fileType, boolean autoIdentify, String data, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Create a new table and import the raw data provided into the created table.
      Parameters:
      tableName - Name of the new table to be created.
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      data - Raw data to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A JSONObject of import result.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importRawData

      public org.json.JSONObject importRawData(long viewId, String importType, String fileType, boolean autoIdentify, String data, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Import the raw data provided into the table.
      Parameters:
      viewId - Id of the view where the data to be imported.
      importType - The type of import. Can be one of
      • APPEND
      • TRUNCATEADD
      • UPDATEADD
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      data - Raw data to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A JSONObject of import result.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importBulkDataInNewTable

      public long importBulkDataInNewTable(String tableName, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Asynchronously create a new table and import the data contained in the mentioned file into the created table.
      Parameters:
      tableName - Name of the new table to be created.
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A long of the job id created.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importBulkData

      public long importBulkData(long viewId, String importType, String fileType, boolean autoIdentify, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Asynchronously import the data contained in the mentioned file into the table.
      Parameters:
      viewId - Id of the view where the data to be imported.
      importType - The type of import. Can be one of
      • APPEND
      • TRUNCATEADD
      • UPDATEADD
      fileType - Type of the file to be imported.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      config - Contains any additional control configurations. Can be null.
      Returns:
      A long of job id created.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • getImportJobDetails

      public org.json.JSONObject getImportJobDetails(long jobId) throws ServerException, ParseException, IOException, org.json.JSONException
      Returns the details of the import job.
      Parameters:
      jobId - Id of the import job.
      Returns:
      A JSONObject of import result.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • exportData

      public void exportData(long viewId, String responseFormat, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Export the mentioned table (or) view data.
      Parameters:
      viewId - Id of the view to be exported.
      responseFormat - The format in which the data is to be exported.
      filePath - Path of the file where the data exported to be stored.
      config - Contains any additional control configurations. Can be null.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • exportData

      public void exportData(long viewId, String responseFormat, OutputStream stream, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Export the mentioned table (or) view data.
      Parameters:
      viewId - Id of the view to be exported.
      responseFormat - The format in which the data is to be exported.
      stream - Outputstream where the data exported to be stored.
      config - Contains any additional control configurations. Can be null.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • exportDataUsingSQL

      public void exportDataUsingSQL(String sqlQuery, String responseFormat, OutputStream stream, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Internally used in JDBC driver
      Throws:
      ServerException
      ParseException
      IOException
      org.json.JSONException
    • exportDataUsingSQL

      public void exportDataUsingSQL(String sqlQuery, String responseFormat, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Internally used in JDBC driver
      Throws:
      ServerException
      ParseException
      IOException
      org.json.JSONException
    • initiateBulkExport

      public long initiateBulkExport(long viewId, String responseFormat, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Initiate asynchronous export for the mentioned table (or) view data.
      Parameters:
      viewId - Id of the view to be exported.
      responseFormat - The format in which the data is to be exported.
      config - Contains any additional control configurations. Can be null.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • initiateBulkExportUsingSQL

      public long initiateBulkExportUsingSQL(String sqlQuery, String responseFormat, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException
      Initiate asynchronous export with the given SQL Query.
      Parameters:
      sqlQuery - The SQL Query whose output is exported.
      responseFormat - The format in which the data is to be exported.
      config - Contains any additional control configurations. Can be null.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • getExportJobDetails

      public org.json.JSONObject getExportJobDetails(long jobId) throws ServerException, ParseException, IOException, org.json.JSONException
      Returns the details of the export job.
      Parameters:
      jobId - Id of the export job.
      Returns:
      A JSONObject of export job details.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • exportBulkData

      public void exportBulkData(long jobId, String filePath) throws ServerException, ParseException, IOException, org.json.JSONException
      Download the exported data for the mentioned job id.
      Parameters:
      jobId - Id of the job to be exported.
      filePath - Path of the file where the data exported to be stored.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • exportBulkData

      public void exportBulkData(long jobId, OutputStream stream) throws ServerException, ParseException, IOException, org.json.JSONException
      Download the exported data for the mentioned job id.
      Parameters:
      jobId - Id of the job to be exported.
      stream - Outputstream where the data exported to be stored.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
    • importDataInNewTableAsBatches

      public long importDataInNewTableAsBatches(String tableName, boolean autoIdentify, String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig) throws ServerException, ParseException, IOException, org.json.JSONException, Exception
      Create a new table and import the data contained in the mentioned file into the created table.
      Parameters:
      tableName - Name of the new table to be created.
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      batchSize - Number of lines per batch.
      config - Contains any additional control configurations. Can be null.
      toolConfig - Contains any additional control configurations for the parser tool. Can be null.
      Returns:
      A long of the job id created.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
      Exception
    • importDataAsBatches

      public long importDataAsBatches(long viewId, String importType, boolean autoIdentify, String filePath, int batchSize, org.json.JSONObject config, org.json.JSONObject toolConfig) throws ServerException, ParseException, IOException, org.json.JSONException, Exception
      Asynchronously import the data contained in the mentioned file into the table.
      Parameters:
      viewId - Id of the view where the data to be imported.
      importType - The type of import. Can be one of
      • APPEND
      • TRUNCATEADD
      • UPDATEADD
      autoIdentify - Used to specify whether to auto identify the CSV format.
      filePath - Path of the file to be imported.
      batchSize - Number of lines per batch.
      config - Contains any additional control configurations. Can be null.
      toolConfig - Contains any additional control configurations for the parser tool. Can be null.
      Returns:
      A long of job id created.
      Throws:
      ServerException - If the server has received the request but did not process the request, due to some error.
      ParseException - If the server has responded but the client was not able to parse the response.
      IOException - If any communication related errors like request time out occurs, when trying to contact the service.
      org.json.JSONException - If any errors while processing the JSON data.
      Exception
    • handleCustomBatchImport

      public org.json.JSONObject handleCustomBatchImport(long viewId, String filePath, org.json.JSONObject config) throws ServerException, ParseException, IOException, org.json.JSONException, Exception
      Throws:
      ServerException
      ParseException
      IOException
      org.json.JSONException
      Exception