Deploying Custom API Endpoints
Last updated
Last updated
Neurelo instantly creates an API end point for every custom query once it is committed in a branch. This custom query API end point can be deployed to one or many environments inside a project. Here is how to use it:
Create a custom query using AI Assist or manually.
Click on "Commit" to save this custom query
At the time of the commit, Neurelo offers a choice to deploy this custom query to one or more running environment if there are no schema related migrations needed in the environment.
Select environment(s) that you would like to deploy this custom query as part of the commit step. You can always also go into the Environments
Your environment should be ready to go. Make sure you have the appropriate environment API Key so you can use it to hit the Custom Query Endpoint
You can access this custom query API endpoint at the URL for your Environment
For REST, this endpoint can be accessed at ${API_URL_BASE}/custom/<endpointName>
(e.g. custom/authorsNumBooks) using the configured HTTP method (GET
/POST
/PATCH
/DELETE
) for the endpoint
For GraphQL, this endpoint can be accessed with a POST
at ${API_URL_BASE}/graphql
using custom_<endpointName>
(e.g. custom_authorsNumBooks) as the field name in a Query or Mutation operation.
If the "Deploy" option is not offered as part of the commit step (because migrations are needed in the environment) or you want to skip the "Deploy" step here, you can deploy this Commit later from Environment settings option.
To deploy custom queries in a specific environment, access the specific environment from the left navigation panel under a project
You must Stop Runner sfrom the top right side of the page. And once the runners have been stopped, you can select the appropriate Commit of the Definition to be used for the environment from the Commit drop down right next to the Start/Stop Runner button
Once the appropriate definition has been selected, click on Start Runner. Runners should start in a few seconds and the new definition would be deployed and be live in that specific environment.
You can test your custom query using any HTTP Client (Postman, Insomnia, or even Curl) and write a request with the following format:
REST: GET/POST/PATCH/DELETE ${API_URL_BASE}/custom/<your_custom_query_name>
GraphQL: Query or Mutation with custom_<endpointName> as the field name at POST ${API_URL_BASE}/graphQL
Headers needed:
X-API-KEY
: Your_Environment_API_KEY
Custom Query Endpoints currently are only supported with API Keys that have both Read and Write permissions. Please don't use Read-Only keys when calling Custom Query endpoints.