skip to main content
Input REST file syntax : Table definition entries : Query paths : Arrays of endpoints
  

Try DataDirect Drivers Now
Arrays of endpoints
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.
Important: To determine the endpoint best suited for your query, starting at the top of the array, the driver attempts to match the WHERE clause parameter to the supplied paths. The driver will use the first endpoint in the list that successfully satisfies the query; therefore, the endpoints should be specified in an order of most-specific to least-specific to ensure that the most appropriate endpoint is used.
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 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