Copy Reports

Tags:  

Copy Reports





Introduction


The Copy Reports API is used to copy one or more reports  (all reports types are supported) from one database to another within the same account or even across user accounts. The source database administrator should generate and provide the Copy Database Key, the secret key used to authorize the destination database administrator. Copying the reports using this API will copy the report along with the relationships involved and the formula columns associated with the source report. It is necessary that the parent tables of the view in the source database should exists with the same name in the destination database.


Getting Started


It is recommended to go through the Zoho Reports API Prerequisites before using Copy Reports API.


Request


The sample request URL is below.

https://reportsapi.zoho.com/api/source_account@zoho.com/SourceEmployeeDB?ZOHO_ACTION=COPYREPORTS
&ZOHO_VIEWTOCOPY=EmployeeDetails,Employee Salary&ZOHO_DATABASE_NAME=DestinationEmployeeDB
&ZOHO_COPY_DB_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Query String Parameters

The below table shows the list of Query String parameters that has to be passed along with the request URL.

Parameter NameDescription
ZOHO_ACTIONThis parameter value should be COPYREPORTS

Note:
This parameter should be in the same case(UPPER CASE) as given in this document.
ZOHO_VIEWTOCOPYThis parameter holds the list of  view names. In case of more than one views, the view names should be separated by comma ( , ).

Example:
ZOHO_VIEWTOCOPY=View1,View2,View3,...
ZOHO_DATABASE_NAMEThis parameter holds the name of the database (destination database) where the reports (specified in ZOHO_VIEWSTOCOPY parameter) has to be copied
ZOHO_COPY_DB_KEYThe secret key used for allowing the user to copy the database / reports. The source database owner has to invoke the below URL to get the Copy Database Secret Key.

https://reportsapi.zoho.com/api/abcd@zoho.com/SourceEmployeeDB?ZOHO_ACTION=GETCOPYDBKEY&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=<source_db_owner_authtoken>&ZOHO_API_VERSION=1.0

Note: You need to provide the appropriate values in the above URL to generate the corresponding Copy Database Key for your setup
authtoken
The authtoken parameter should hold the Auth Token of the Destination Database Owner Account.



Response



The sample response sent from the server if the Copy Reports process is success.

XML Format:

<response uri="/api/source_account@zoho.com/SourceEmployeeDB" action="COPYREPORTS">
<result>
  <message>Successfully View(s) Copied</message>     
</result>
</response>


JSON Format:

{
"response":
             {
         "uri":"\/api\/source_account@zoho.com\/SourceEmployeeDB",
         "action":"COPYREPORTS",
         "result":
                   {
                         "message": "Successfully View(s) Copied"
                    }
 }
}


Error Handling



This section explains about the error response sent from the Zoho Reports server on failure of Copy Reports API. The sample error response is below.

XML Format:

<response uri="/api/source_account@zoho.com/SourceEmployeeDB" action="COPYREPORTS">
<error>  <code>15005</code>
<message>The View name 'EmployeeDetails' for the given View id '3682000000564002' is already exists in the destination database '3835000001921020'.</message>
</error>
</response>


JSON Format:

{
"response"
:
{
"uri
": "\/api\/source_account@zoho.com\/SourceEmployeeDB",
"action"
: "COPYREPORTS",
"error"
:
{ "code":15005,
"message"
: "The View name \'EmployeeDetails\' for the given View id \'3682000000564002\' is already exists in the destination database \'3835000001921020\'."
}
}
}


Error Codes:

The below table shows the list of error codes sent from server on failure of Copy Reports API Request along with the reason and the solution for the same.

Error CodeReasonSolution
15000A table / view which is needed to copy the specified report is missing in the destination databaseCheck the destination database and create the missing table/view
15001A column which is needed to copy the specified report is missing in the destination databaseCheck the destination database and create the column before copying the report
15002
A formula column which is needed to copy the specified report is missing in the destination databaseCheck the destination database and create the formula column before copying the report
15005
The report name specified already exists in the destination database
Check whether the report  with the same name exists in the destination database. Try renaming the source report or the report in destination database and invoke the API again
15007
Insufficient privileges to copy the report
Check whether the Copy Database Key is valid
15012
The reports specified in the API request is not present in the Source Database
Check the reports specified in the ZOHO_VIEWTOCOPY parameter is correct and are available. 


In case you encounter any other errors, please mail the API request URL parameters and error response details to support@zohoreports.com. We will get back to you shortly with the best possible solution.


    Post a comment

    Your Name or E-mail ID (mandatory)

    Note: Your comment will be published after approval of the owner.




     RSS of this page