Package com.zoho.analytics.client
Class AnalyticsClient
- java.lang.Object
-
- com.zoho.analytics.client.AnalyticsClient
-
public class AnalyticsClient extends java.lang.ObjectAnalyticsClient provides the java based language binding to the HTTPS based API of Zoho Analytics.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnalyticsClient.ZAuthenticator
-
Constructor Summary
Constructors Constructor Description AnalyticsClient(java.lang.String clientId, java.lang.String clientSecret, java.lang.String refreshToken)Creates a newAnalyticsClientinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclose(java.io.Closeable... args)BulkAPIgetBulkInstance(long orgId, long workspaceId)Creates a newBulkAPIinstance.intgetConnectionTimeout()Returns the timeout until a connection is established.org.json.JSONObjectgetDashboards()Returns list of all accessible dashboards.OrgAPIgetOrgInstance(long orgId)Creates a newOrgAPIinstance.org.json.JSONArraygetOrgs()Returns list of all accessible organizations.org.json.JSONArraygetOwnedDashboards()Returns list of owned dashboards.org.json.JSONArraygetOwnedWorkspaces()Returns list of owned workspaces.intgetReadTimeout()Returns the read timeout value which will wait for the packet to receive from the server end.org.json.JSONArraygetRecentViews()Returns list of recently accessed views.org.json.JSONArraygetSharedDashboards()Returns list of shared dashboards.org.json.JSONArraygetSharedWorkspaces()Returns list of shared workspaces.org.json.JSONObjectgetViewDetails(long viewId, org.json.JSONObject config)Returns details of the specified view.ViewAPIgetViewInstance(long orgId, long workspaceId, long viewId)Creates a newViewAPIinstance.org.json.JSONObjectgetWorkspaceDetails(long workspaceId)Returns details of the specified workspace.WorkspaceAPIgetWorkspaceInstance(long orgId, long workspaceId)Creates a newWorkspaceAPIinstance.org.json.JSONObjectgetWorkspaces()Returns list of all accessible workspaces.org.json.JSONObjectimportDataInBatches(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.io.File csvFile, int batchSize, org.json.JSONObject toolConfig)protected org.json.JSONObjectsendAPIRequest(java.lang.String reqMethod, java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders)Internal method to send API request.protected org.json.JSONObjectsendBatchImportAPIRequest(java.lang.String endPoint, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler)Internal method to send API request.protected org.json.JSONObjectsendExportAPIRequest(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler)Internal method to send API request.protected org.json.JSONObjectsendImportAPIRequest(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler)Internal method to send API request.voidsetAccessToken(java.lang.String accessToken)voidsetAccountsServerURL(java.lang.String serverURL)Sets the accounts server URL.voidsetAnalyticsServerURL(java.lang.String serverURL)Sets the analytics server URL.voidsetConnectionTimeout(int timeout)Sets the timeout until a connection is established.voidsetHeaders(java.lang.String key, java.lang.String value)voidsetProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUsername, java.lang.String proxyPassword)To specify the proxy server details.voidsetReadTimeout(int timeout)Sets the read timeout which will wait for data response from the server end.protected voidwriteLine(java.lang.Appendable writer, java.lang.String curLine)
-
-
-
Constructor Detail
-
AnalyticsClient
public AnalyticsClient(java.lang.String clientId, java.lang.String clientSecret, java.lang.String refreshToken)Creates a newAnalyticsClientinstance.- Parameters:
clientId- The client ID string that has been obtained during the client registration.clientSecret- The client secret string that has been obtained during the client registration.refreshToken- The refresh token string that has been obtained through accounts API.
-
-
Method Detail
-
setAccessToken
public void setAccessToken(java.lang.String accessToken)
-
getOrgInstance
public OrgAPI getOrgInstance(long orgId)
Creates a newOrgAPIinstance.- Parameters:
orgId- The ID of the organization.- Returns:
- OrgAPI instance.
-
getWorkspaceInstance
public WorkspaceAPI getWorkspaceInstance(long orgId, long workspaceId)
Creates a newWorkspaceAPIinstance.- Parameters:
orgId- The ID of the organization.workspaceId- The ID of the workspace.- Returns:
- WorkspaceAPI instance.
-
getViewInstance
public ViewAPI getViewInstance(long orgId, long workspaceId, long viewId)
Creates a newViewAPIinstance.- Parameters:
orgId- The ID of the organization.workspaceId- The ID of the workspace.viewId- The ID of the view.- Returns:
- ViewAPI instance.
-
getBulkInstance
public BulkAPI getBulkInstance(long orgId, long workspaceId)
Creates a newBulkAPIinstance.- Parameters:
orgId- The ID of the organization.workspaceId- The ID of the workspace.- Returns:
- BulkAPI instance.
-
getOrgs
public org.json.JSONArray getOrgs() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of all accessible organizations.- Returns:
- A
JSONArrayof organizations list. - 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.java.io.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.
-
getWorkspaces
public org.json.JSONObject getWorkspaces() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of all accessible workspaces.- Returns:
- A
JSONObjectof workspaces list. - 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.java.io.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.
-
getOwnedWorkspaces
public org.json.JSONArray getOwnedWorkspaces() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of owned workspaces.- Returns:
- A
JSONArrayof owned workspaces list. - 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.java.io.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.
-
getSharedWorkspaces
public org.json.JSONArray getSharedWorkspaces() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of shared workspaces.- Returns:
- A
JSONArrayof shared workspaces list. - 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.java.io.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.
-
getRecentViews
public org.json.JSONArray getRecentViews() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of recently accessed views.- Returns:
- A
JSONArrayof recent views list. - 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.java.io.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.
-
getDashboards
public org.json.JSONObject getDashboards() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of all accessible dashboards.- Returns:
- A
JSONObjectof dashboards list. - 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.java.io.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.
-
getOwnedDashboards
public org.json.JSONArray getOwnedDashboards() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of owned dashboards.- Returns:
- A
JSONArrayof owned dashboards list. - 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.java.io.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.
-
getSharedDashboards
public org.json.JSONArray getSharedDashboards() throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns list of shared dashboards.- Returns:
- A
JSONArrayof shared dashboards list. - 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.java.io.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.
-
getWorkspaceDetails
public org.json.JSONObject getWorkspaceDetails(long workspaceId) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns details of the specified workspace.- Parameters:
workspaceId- The ID of the workspace.- Returns:
- A
JSONObjectof workspace 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.java.io.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.
-
getViewDetails
public org.json.JSONObject getViewDetails(long viewId, org.json.JSONObject config) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionReturns details of the specified view.- Parameters:
viewId- The ID of the view.config- Contains any additional control configurations. Can be null.- Returns:
- A
JSONObjectof view 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.java.io.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.
-
setAnalyticsServerURL
public void setAnalyticsServerURL(java.lang.String serverURL)
Sets the analytics server URL.- Parameters:
serverURL- The server URL.
-
setAccountsServerURL
public void setAccountsServerURL(java.lang.String serverURL)
Sets the accounts server URL.- Parameters:
serverURL- The server URL.
-
getConnectionTimeout
public int getConnectionTimeout()
Returns the timeout until a connection is established. A value of zero means the timeout is not used. The default value is 5000.- Returns:
- A
intvalue.
-
setConnectionTimeout
public void setConnectionTimeout(int timeout)
Sets the timeout until a connection is established. A value of zero means the timeout is not used. The default value is 5000.- Parameters:
timeout- Contains connection timeout value.
-
getReadTimeout
public int getReadTimeout()
Returns the read timeout value which will wait for the packet to receive from the server end. The default value is 0.- Returns:
- A
intvalue.
-
setReadTimeout
public void setReadTimeout(int timeout)
Sets the read timeout which will wait for data response from the server end. The default value is 0.- Parameters:
timeout- Contains read timeout value.
-
setProxy
public void setProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUsername, java.lang.String proxyPassword)To specify the proxy server details. (When configuring the proxy settings, ensure that the 'Basic' authentication scheme is not disabled by the JDK).- Parameters:
proxyHost- The hostname/IP address of the proxy server.proxyPort- The proxy server port.proxyUsername- The user name for proxy-server authentication.proxyPassword- The password for proxy server authentication.
-
sendAPIRequest
protected org.json.JSONObject sendAPIRequest(java.lang.String reqMethod, java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionInternal method to send API request.- Throws:
ServerExceptionParseExceptionjava.io.IOExceptionorg.json.JSONException
-
sendExportAPIRequest
protected org.json.JSONObject sendExportAPIRequest(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionInternal method to send API request.- Throws:
ServerExceptionParseExceptionjava.io.IOExceptionorg.json.JSONException
-
sendImportAPIRequest
protected org.json.JSONObject sendImportAPIRequest(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionInternal method to send API request.- Throws:
ServerExceptionParseExceptionjava.io.IOExceptionorg.json.JSONException
-
sendBatchImportAPIRequest
protected org.json.JSONObject sendBatchImportAPIRequest(java.lang.String endPoint, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.lang.Object dataHandler) throws ServerException, ParseException, java.io.IOException, org.json.JSONExceptionInternal method to send API request.- Throws:
ServerExceptionParseExceptionjava.io.IOExceptionorg.json.JSONException
-
setHeaders
public void setHeaders(java.lang.String key, java.lang.String value) throws java.lang.Exception- Throws:
java.lang.Exception
-
importDataInBatches
public org.json.JSONObject importDataInBatches(java.lang.String endPoint, org.json.JSONObject config, java.util.Map<java.lang.String,java.lang.String> reqHeaders, java.io.File csvFile, int batchSize, org.json.JSONObject toolConfig) throws java.lang.Exception- Throws:
java.lang.Exception
-
writeLine
protected void writeLine(java.lang.Appendable writer, java.lang.String curLine) throws java.io.IOException- Throws:
java.io.IOException
-
close
public static void close(java.io.Closeable... args)
-
-