Enable the Data API

On this page

SingleStore’s Data API is accessible via a built-in HTTP server. The Data API is enabled by default. When the Data API is enabled, it will be hosted on a port that is different from the SingleStore Helios port.

Test the Data API

Call the GET /ping API request to verify that the HTTP service is running and connectable. To perform this action using cURL, make a GET request to the /ping endpoint with no parameters:

curl https://svc-XXXX-dml.aws-ireland-1.svc.singlestore.com/ping

If the Data API service is available and is able to respond to requests, you will receive the following response along with a 200 OK status code, indicating a successful HTTP response.

pong

If an error occurs, you will receive one of the HTTP response status codes, along with the error description in the response body. For more information, refer to the Data API Endpoint Reference.

The GET /ping request can only verify whether the HTTP service is running and connectable. To verify that the database can receive queries, use the /exec and /query endpoints.

The following cURL command makes a POST API request to the /query/rows endpoint. (Replace root:password in the HTTP request with your SingleStore username:password string.)

curl -H "Content-Type: application/json" --data '{"sql": "select 1+1"}' --user 'root:password' https://svc-XXXX-dml.aws-ireland-1.svc.singlestore.com/api/v2/query/rows

If the API call is successful, you should see the following results along with a 200 OK status code.

{"results":[{"rows":[{"1+1":2}]}]}

If an error occurs, you will receive one of the HTTP response status codes, along with the error description in the response body. For more information, refer to the Data API Endpoint Reference.

If you format the JSON output with a formatting tool, the results appear as follows. (Recommended JSON formatting tools: jq, JSONLint)

{
"results": [
{
"rows": [
{
"1+1": 2
}
]
}
]
}

Note: The GET /ping request should be used in automated health checks. To verify specific health metrics, use the /exec and /query endpoints.

Last modified: November 23, 2023

Was this article helpful?