Data API

On this page

SingleStore provides the Data API to execute SQL statements against your database over an HTTP connection. The Data API can be used to integrate SingleStore with serverless architecture, develop custom applications, and build seamless integrations with applications.

SingleStore's Data API is authenticated to the server using the HTTP Basic and Bearer Authentication standards, which must be used in conjunction with SSL (HTTPS) for secure communication over the network. The Data API uses standard HTTP methods and response codes and supports URI versioning. It also uses JSON-encoded responses with support for conventional data type conversions. The Data API is accessible via a built-in HTTP server. It can be easily enabled or disabled using engine variables.

The Data API supports all SQL statements that can be run in a direct database connection with SingleStore. To learn about the supported Data API endpoints, refer to Data API Endpoint Reference.

The Data API can support concurrent connections up to the value of the http_api_pool_capacity engine variable. If the value of the max_connection_threads engine variable is less than the value of http_api_pool_capacity, then the number of supported concurrent requests is limited to the value of max_connection_threads. In such cases, you can increase the values of both the max_connection_threads and the http_api_pool_capacity engine variables for your cluster. Refer to List of Engine Variables for more information. If the server is already running when you update the configuration, run the following command at the SingleStore command-line for the changes to take effect.

RESTART PROXY;

SingleStore does not recommend updating or managing session-related entities using the Data API, for example, temporary tables, session variables, etc. Temporary tables created using the Data API are not automatically dropped when a connection is closed. Hence, you must explicitly drop any temporary tables created using the Data API before closing a connection (from within the same connection). To drop any temporary tables that exist after the connection is closed, kill the connection associated with that temporary table using the following commands:

-- Obtain the connection ID for the temporary table --
SHOW TEMPORARY TABLES;
-- Use the connection ID to kill the connection --
KILL CONNECTION <conn_ID>;

FAQs

  • Is this a REST API?

    No, the Data API is a JSON-based SQL API.

  • Is there a limit on the request body size?

    The request body size must not exceed 1MB.

  • Is there a limit on the response size?

    The response is streamed not buffered. There are no limits explicitly set on the response size.

  • How many concurrent requests are supported by the Data API?

    The Data API can process up to 192 requests in parallel per aggregator, which is the default value of the max_connection_threads engine variable. To support additional requests, you can increase the values of both the max_connection_threads and the http_api_pool_capacity engine variables up to the maximum values supported by the database engine.

  • Does it support API pagination?

    By itself, the Data API does not implement any logic to handle pagination. However, users can build pagination into the queries they send to the API.

In this section

Last modified: August 3, 2023

Was this article helpful?