Data sources define a connection to a database or other source of data for running reports. Data sources are resources in the repository that can be created, modified, and deleted with the repository service.
As with all descriptors, the descriptors for data sources contain properties and values that define the data source. Different types of data sources have different properties, but all are self-explanatory. For example, the following call returns the descriptor for a virtual data source in the sample data:
GET http://localhost:8080/jasperserver/rest/resource/datasources/SugarFoodma...
The resource descriptor is shown below. The data sources that make up the virtual data source are given as children descriptors of type generic datasource. Each child descriptor has an ID within the virtual data source (PROP_DATASOURCE_SUB_DS _ID) and a repository URI (PROP_REFERENCE_URI):
<resourceDescriptor name="SugarFoodmartVDS" wsType="virtual" uriString="/datasources/SugarFoodmartVDS" isNew="false"> <label>SugarCRM-Foodmart Virtual Data Source</label> <description>Virtual Data Source Combining SugarCRM and Foodmart</description> <creationDate>1366267873303</creationDate> |
<resourceProperty name="PROP_RESOURCE_TYPE"> <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain. VirtualReportDataSource</value> </resourceProperty> <resourceProperty name="PROP_PARENT_FOLDER"> <value>/datasources</value> </resourceProperty> <resourceProperty name="PROP_VERSION"> <value>0</value> </resourceProperty> <resourceProperty name="PROP_SECURITY_PERMISSION_MASK"> <value>33</value> </resourceProperty> <resourceDescriptor wsType="datasource" isNew="false"> <resourceProperty name="PROP_REFERENCE_URI"> <value>/analysis/datasources/SugarCRMDataSourceJNDI</value> </resourceProperty> <resourceProperty name="PROP_IS_REFERENCE"> <value>true</value> </resourceProperty> <resourceProperty name="PROP_DATASOURCE_SUB_DS_ID"> <value>SugarCRMDataSource</value> </resourceProperty> </resourceDescriptor> <resourceDescriptor wsType="datasource" isNew="false"> <resourceProperty name="PROP_REFERENCE_URI"> <value>/analysis/datasources/FoodmartDataSourceJNDI</value> </resourceProperty> <resourceProperty name="PROP_IS_REFERENCE"> <value>true</value> </resourceProperty> <resourceProperty name="PROP_DATASOURCE_SUB_DS_ID"> <value>FoodmartDataSource</value> </resourceProperty> </resourceDescriptor> </resourceDescriptor> |
If you wanted more information about the child data sources, use the resource service again to request their descriptors, for example:
GET http://localhost:8080/jasperserver/rest/resource/analysis/datasources/Fo...