Connecting to REST API
The REST API connector requires specific information to create a connection to it in Data Virtualization.
For more information, see Data sources in object storage in Data Virtualization.
Before you begin
You need the following connection details to set a connection with REST API:
- Hostname URL
Procedure
To connect with REST API in Data Virtualization, follow these steps.
On the navigation menu, click . The Data sources page appears.
Click to view a list of data sources.
-
Select the REST API data source connection.
-
Enter the connection name and description.
-
Enter the URL for your host database. You can se a connection to the REST API data source by using a sample property method or the model file method.
- Sample property method
- Specify an endpoint for your hostname, such as this example URL: https://domain.example.com/api/v1/employee_name. This method allows access to data from a single endpoint with minimal configuration. You do not need to provide a Model file.
- Model file method
-
Note: You can download the Autonomous REST Composer (ARC) tool to create and edit model files. Go to the Data sources page and select .
- Enter the Base URL of your hostname (https://domain.example.com) to allow access to data from multiple endpoints.
- For this method, you need to manually create the Model file and then paste the file into the Model file field. To create your Model file and map your endpoints to tables, follow the steps in Model file syntax. For reference on the basic format for mapping endpoints to tables, see the example in Creating a Model file.
- You can modify your Model file to fit your environment, such as how the driver processes HTTP status codes or the different configurations for GET requests. For the REST API data source, you do not need a POST request or authentication object as shown in the Example model file.
- Complete any of the following tasks.
- Using an authentication method
-
- Select your authentication method from the list:
- Basic Authentication
- Bearer token
- None
- Open Authentication 2.0 (OAuth2)
- Provide the required credentials.
- Select your authentication method from the list:
- Using API key authentication that is configured as a query parameter
- To use API key authentication, ensure your data source supports API key passing as a query
parameter before you complete these steps.
- To use API key authentication, add the API key directly to the host URL.For example: In this example URL, you would replace <your_api_key> with the API key.
https://api.example.com/resource?apikey=<your_api_key> - In Credentials, select None as your authentication method.
- To use API key authentication, add the API key directly to the host URL.
- Using API key authentication that is configured as a header parameter
- To use API key authentication that is configured as a header parameter, complete these steps.
- In the Additional properties field, enter the following parameter.
Replace <your_api_key> with the API key.
AuthenticationMethod=HttpHeader;SecurityToken=ApiKey<your_api_key> - In Credentials, select None as your authentication method.
- In the Additional properties field, enter the following parameter.
Replace <your_api_key> with the API key.
- Creating a new REST API connection to a URL that is behind a proxy
- To create a connection to
a REST API URL that is behind a proxy, complete these steps when creating a new REST API connection.
- Conditional step: If the URL that is behind a proxy requires SSL certificate validation, then ensure you upload the SSL certificate, regardless of whether or not you check off Validate the SSL certificate. To upload the certificate, complete the workaround steps in Creating a REST API connection with public CA authentication fails when passed through a proxy server.
- Provide these properties in the Additional properities field: Note: Only include
ProxyUser=<User>;ProxyPassword=<Password>;if the proxy server requires basic authentication.- Replace <Host> with the server name and IP address used to identify the
proxy server for the connection in the format:
server_name | IP_address. See also ProxyHost. - Replace <Port> with the port number where the proxy server is listening for HTTP or HTTPS requests for the specified connection. See also ProxyPort.
- Replace <User> with the user name needed to connect to the proxy server for the specified connection. See also ProxyUser.
- Replace <Password> with the password needed to connect to the proxy server for the specified connection. See also ProxyPassword.
ProxyHost=<Host>;ProxyPort=<Port>;ProxyUser=<User>;ProxyPassword=<Password>; - Replace <Host> with the server name and IP address used to identify the
proxy server for the connection in the format:
-
If the connection requires a custom SSL certificate, enter the certificate in the SSL certificate field.
-
Click Create to add the connection to the data source environment.