To configure a data source using the example files, you will need to create a data source definition. The content required to create a data source definition is divided into three sections.
First, you will need to import the data source class. For example:
import com.ddtek.jdbcx.restful.RestfulDataSource;
Next, you will need to set the values and define the data source. For example, the following definition contains the minimum properties used for a data source using URL parameter authentication and a REST file:
RestfulDataSource mds = new RestfulDataSource();
mds.setDescription("My Restful Data Source");
mds.setServerName("https://api.mysite.com/");
mds.setAuthenticationMethod("UrlParameter");
mds.setAuthParam("apikey");
mds.setConfig("C:/path/to/mysite.rest");
mds.setSecurityToken("XaBARTsLZReM");
The following example contains the minimum properties for a session using URL parameter authentication without a REST file.
RestfulDataSource mds = new RestfulDataSource();
mds.setDescription("My Restful Data Source");
mds.setAuthenticationMethod("UrlParameter");
mds.setAuthParam("apikey");
mds.setSample("https://api.mysite.com/countries/get/all");
mds.setSecurityToken("XaBARTsLZReM");
Finally, you will need to configure the example application to print out the data source attributes. Note that this code is specific to the driver and should only be used in the example application. For example, you would add the following section for a simple data source using URL parameter authentication with a REST file: