Arrays of endpoints
- Last Updated: November 2, 2022
- 2 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
You can specify an array of endpoints in a comma-separated list using the
#path property. This allows you to specify multiple endpoints to
different representations of the same data. When a query is executed, the driver maximizes
performance by determining which endpoint would return the smallest result set that
satisfies your query; then, issues a request to that endpoint. Arrays of endpoints are
issued as GET requests, unless they are specified in a POST request entry.
The following demonstrates the basic syntax for issuing an array of endpoints. Using this form, you may specify two or more endpoints in an array.
#path:"[
<host_name>/<endpoint_path1>,
<host_name>/<endpoint_path2>,
<host_name>/<endpoint_path3>
]
- host_name
- (optional) is the protocol and host name components of the URL endpoint. For example, http://example.com. You can omit this value by specifying the host name using the ServerName property.
- endpoint_path
- is the path component of the URL endpoint. For example,
times. The value must be valid URL-encoded syntax. For example, spaces in an endpoint are replaced with%20. See "URL-encoded values" for details.
The following demonstrates an array of endpoints. In this example, /orders/{orderid} returns data for just one order, /customer/{custid}/orders returns data for all orders for a
customer, and /orders returns all orders. Note that the
array is specified in order from most-specific to least-specific to ensure that the driver
uses the endpoint best suited for your query.
{
"Orders":{
#path:"[
"/orders/{orderid}",
"/customer/{custid}/orders",
"/orders"
]
}
For example, if you executed the following query, the driver would return results for order
abc123 from the /orders/{orderid} end
point.
SELECT * FROM ORDERS WHERE ORDERID=abc123
The following query would return all the results for the customer with an ID of
98765 from the /customer/{custid}/orders endpoint.
SELECT * FROM ORDERS WHERE CUSTID=98765
The following query would return results for all orders from the /orders endpoint.
SELECT * FROM ORDERS