π₯οΈ Endpoint
Turn SQL or GraphQL into restful api endpoints
Sentio Endpoint is a feature that allow users can turn their SQL or GraphQL queries into restful APIs. This feature is useful for users who want to share their query with others or use it in their application.
Endpoint for SQL Query
To create an endpoint for a SQL query, you first need to create a Saved SQL Query.
Save the SQL Query
You can do this by clicking on the Save Query
button on the SQL editor page. You will be prompted to enter a name for the query. Once you have entered the name, click on the Save
button.

The saved query will now appear in the Saved Queries
section of the SQL editor page.
Add parameters to the query
You may want to add parameters to the query so that users can pass in values when they make a request to the endpoint. To do this, click on the Parameter
button under the editor. This will open the Edit Parameters
dialog. The parameters you added here will be inserted into the sql query as placeholders ${parameter_name}
. For example, if you want to add a parameter called limit
, you can add it to the query like this:
select * from table limit ${limit}

Turn the Saved SQL query into an endpoint
By clicking on the + Endpoint
button, you can turn the saved query into an endpoint. The endpoint needs to have a name and a path. The path is unique to the current project and will be used to access the endpoint. You can also set the permission option for this endpoint. Once you have entered the required information, click on the Create Endpoint
button.

All of the parameters you added to the query will be converted into body parameters for the endpoint.
Access the endpoint
Switch to the Docs
tab to see the details of the endpoint you created. You can see the path of the endpoint, the URL, and the parameters that the endpoint accepts. You can also test the endpoint by clicking on the Try it
button. This will send a request to the endpoint and display the response in the Response
section.

Endpoint for GraphQL Query
Same as SQL query, you can create an endpoint for a GraphQL query. To create an endpoint for a GraphQL query, you first need to create a Saved GraphQL Query.

Also from saved queries, you can create an endpoint for a GraphQL query. The process is the same as creating an endpoint for a SQL query. You can add parameters to the query and turn it into an endpoint by clicking on the + Endpoint
button.

Updated 2 months ago