skip to main content
Using the driver : Authentication : URL parameter authentication
  

Try DataDirect Drivers Now

URL parameter authentication

To configure the driver to use HTTP header authentication:
*Configure the minimum properties required for a connection:
*If you are using a REST file, set the Config property to provide the name and location of the input REST file. For example, C:/path/to/myrest.rest.
*If you are using the Sample property, set the Sample property to specify the endpoint that the want to connect to and sample. For example, https://example.com/countries/.
*Set the AuthenticationMethod property to UrlParameter.
*Set the AuthParam property to specify the name of the URL parameter used to pass the security token. For example, apikey.
*Set the SecurityToken to specify the security token required to make a connection to your endpoint. For example, XaBARTsLZReM.
*If required by your service, set the User property to specify your logon ID.
*Optionally, specify values for any additional properties you want to configure.
The following examples demonstrates a session using a REST file with URL parameter authentication enabled.
For a connection URL:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:AuthenticationMethod=UrlParameter;AuthParam=apikey;
Config=C:/path/to/myrest.rest;SecurityToken=XaBARTsLZReM;User=jsmith;");
For a data source:
AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAuthenticationMethod("UrlParameter");
mds.setAuthParam(apikey);
mds.setConfig("C:/path/to/myrest.rest");
mds.setSecurityToken("XaBARTsLZReM");
mds.setUser("jsmith");