#### Topics for developers

Other than implementation from the JReport Server UI, advanced users are also allowed to manage versions using the JReport Server API and RMI API.

The JReport Server API and RMI API is a set of Java programming interfaces that run reports, explore report resources, and provide access control for report servers. It is mainly used for writing servlets, JSPs and Java applications with report server features. You can find documentation that describes the usage of the JReport Server API in the section JReport Server APIs and Remote APIs.

Program examples to show how to publish a report to the versioning system, how to run a report, and how to publish a catalog/report can be found in the `<install_root>\help\samples\APIServer` folder.

##### Applying an archive policy

You may find that whenever you create catalog/report template versions, or report result versions, an archive policy is applied. The archive policy is a series of settings for controlling whether or not to use multiple versions for a specific resource, for specifying the maximum version amount and archive location, and for controlling whether or not to auto-delete versions after a certain period of time.

Archive policy parameters

Parameters | Values | Description | Parameters | Values | Description
APIConst.TAG_ENABLE_ARCHIVE_POLICY | true /false | Whether or not to apply a new archive policy. |  |  |
APIConst.TAG_AUTO_ARCHIVE | true /false | Whether or not to auto-archive the viewed result. |  |  |
APIConst.TAG_ARCHIVE_LOCATION | 0 | Built-in version folder is used as the result archiving location. |  |  |
| 1 | The My Reports folder is used as the result archiving location. |  |  |
|  |  | APICONST. TAG_ARCHIVE_MY_DESTINATION |  | Sub folder name in the My Reports folder for this user. For example, /rtp100, which means to output the file to /USERFOLDERPATH/<userid>/rtp100.
| 2 | The Public Reports folder is used as the result archiving location. |  |  |
|  |  | APICONST. TAG_ARCHIVE_PUBLIC_DESTINATION |  | Sub folder name in the Public Reports folder for all the users. For example, /ActimizeTest/rtp100
APIConst.TAG_REPLACE_OLD_VERSION | true /false | Whether or not to replace the previous version. |  |  |
APIConst.TAG_ARCHIVE_NEW_VERSION | true /false | Whether or not to archive the next version as a new version. |  |  |
APICONST. TAG_NEED_MAXVERSION | 0 or N | The number of versions to keep for this resource result. |  |  |
APICONST.TAG_NEED_EXPIRE | true /false | Whether or not to auto delete this version. |  |  |
APIConst.TAG_EXPIRE_METHOD | 0 | Version expires after a number of days. |  |  |
|  |  | APIConst.DAY_EXPIRE | Number | The number of days until a version expires.
| 1 | Version expires after a certain date. |  |  |
|  |  | APIConst.TAG_EXPIRE_YEAR | Number | The year of expiration.
|  |  | APIConst.TAG_EXPIRE_MONTH | Number | The month of expiration.
|  |  | APIConst.TAG_EXPIRE_DATE | Number | The date of expiration.

##### Scheduling report result to the versioning system

You can use the Java class HttpRptServer with the following methods to schedule report result to the versioning system: runTask(), and submitScheduledTask().

There is a Hashtable argument for these two methods, which includes the parameters used for running tasks. Here are some parameters that you will need when specifying your Hashtable for scheduling to version:

Parameters | Values | Description | Parameters | Values | Description
APICONST.TAG_TO_VERSION | true /false | Whether or not to schedule to the versioning system. |  |  |
|  |  | APICONST.TAG_TO_VERSION_EXCEL | true /false | Whether or not to schedule to an Excel version.
|  |  | APICONST.TAG_TO_VERSION_HTML | true /false | Whether or not to schedule to an HTML version.
|  |  | APICONST.TAG_TO_VERSION_PDF | true /false | Whether or not to schedule to a PDF version.
|  |  | APICONST.TAG_TO_VERSION_PS | true /false | Whether or not to schedule to a PostScript version.
|  |  | APICONST.TAG_TO_VERSION_RSD | true /false | Whether or not to schedule to a Page Report Result version.
|  |  | APICONST.TAG_TO_VERSION_RST | true /false | Whether or not to schedule to an rst version.
|  |  | APICONST.TAG_TO_VERSION_RTF | true /false | Whether or not to schedule to an rtf version.
|  |  | APICONST.TAG_TO_VERSION_TXT | true /false | Whether or not to schedule to a TEXT version.
|  |  | APICONST.TAG_TO_VERSION_XML | true /false | Whether or not to schedule to an XML version.

##### Obtaining version information

You will be able to fetch version records with the following function calls:

1. Get the resource manager from the HttpRptServer:

   public ResourceManager getResourceManager()

2. Then use the following methods to obtain a version:
   - Report version
     getReportVersions(String userID, String rptName)
   - Report Result version
     getResultVersion(String userID, String rptName, int versionNumber)
   - Catalog version
     getCatalogVersions(String userID, String catName)
   - Result version
     getResultDocVersions(String userID, String resultDocName)
   - Dashboard version
     getReportVersions(String userID, String dashboardName)
   - Library component version
     getLCVersions(String userID, String lcName)

Note: userID is only used for checking privilege in this method, and not for filtering the submitter.