Connecting Data and Configuration

Version 25.3.9411


Connecting Data and Configuration


After you deploy CData API Server, you need to perform these basic steps from the API Server administration console:

  1. Connect to your data stores.

  2. Build the API.

  3. Configure the API.

  4. Query the API.

Connect to Your Data Stores

API Server supports connecting to relational databases, file stores, and back-end services such as other APIs. Any JDBC driver or provider can supply connectivity to the underlying data source. However, API Server comes with a collection of popular drivers and providers that are already installed.

Detailed information about connecting is available on the Connections page, including the following tasks:

Build the API

After you define a connection to your data source, you need to add the tables (resources) and stored procedures (functions) that you want to use in your API. For detailed instructions, see the following topics on the API page:

You can also modify schemas for your tables without regenerating them from the database.

To modify a schema, simply click the Edit button in the entry for your table. The generated schema contains the three essential components of a schema:

  • an information block that contains the definitions of resource columns

  • the data connection

  • methods that correspond to HTTP methods and call data-processing operations

In addition, you can customize your schema by renaming resources, changing column data types, and so on. For details steps to make such modifications, see Typical Customizations.

Configure the API

After you create tables and stored procedures for your API, perform the steps in the following sections to expose those tables and stored procedures to authorized users and IP addresses (by default, all IP addresses are allowed).

Configuring Access Control

Manage access to your APIs through the web interface, as follows:

  1. Select Settings > Trusted IP Addresses in the API Server administration console to define the IP addresses that are allowed to access API Server.

  2. Configure cross-origin resource sharing if you connect from a browser-based client. To do so, select Settings > Cross-Origin Resource Sharing (CORS) in the administration console.

  3. Click Users in the navigation pane to create users and their corresponding auth tokens.

Authenticating to the APIs

After you deploy the server and create API users, you can provide auth-token authentication in your API requests.

Query the API

You can connect to the standard REST APIs from widely supported tools or interact with the JSON APIs through plain JavaScript.

Connecting through Standard Drivers

Use the CData drivers for API Server to connect to your APIs as a remote database from business-intelligence (BI), analytics, ETL, and other SQL-based tools. You can also connect from native platforms such as .NET, Java, PHP, Objective-C, and so on. For details about API drivers, see the API Driver help documentation.

Connecting through OData

The OData protocol is widely supported by developer tools, and dozens of client libraries are available for working with OData from .NET, Java, PHP, Objective-C, and other platforms. Based on OpenAPI, the APIs are fully documented and discoverable. See Discovery for information about metadata URLs to applications, documentation generators, client-side libraries, and more.

In the CData Software Knowledge Base, you can find quick-start articles about these and other popular OData API consumers (for example, Salesforce Lightning Connect, SharePoint external lists, Microsoft Power BI, and Excel).

The following example query and response is in JSON-formatted OData, the default format.

Request

http://localhost:8080/api.rsc/Cars

Response

{
  "@odata.context":"http://MyServer:MyPort/api.rsc/$metadata#Cars",
  "value":[
    { "Id": "10001", "Model": "MyModel1", "Color": "MyColor1" },
    { "Id": "10002", "Model2": "MyModel2", "Color2": "MyColor2" },
  ]
}

More Information

See the following sections to get started working with the APIs:

  • Configuration - More detailed information about configuring the server.

  • Accessing Table Resources - Information about executing create, read, update, and delete (CRUD) operations on the tables that you surface.

  • Invoking Stored Procedures - Information about extending the set of available operations. (API actions are analogous to stored procedures).