Curiosity for Developers
  • Overview
  • Getting Started
    • Introduction
    • System Overview
      • Workspace
      • Connectors
      • Front End
    • Requirements
    • Installation
      • Deploying on Windows
        • Download Curiosity Workspace for Windows
      • Deploying on Docker
        • Deploying using Docker Desktop App
        • Docker Hub
      • Deploying on Kubernetes
      • Deploying on OpenShift
      • Configuration
    • Configure your Workspace
    • Connecting to a Workspace
      • Download App
    • Built-in Templates
  • Security
    • Introduction
    • Hosting
    • Encryption
    • Users and Access
      • User Invitations
      • Single Sign-On (SSO)
        • Google Sign-In
        • Microsoft / Azure AD
        • Okta
        • Auth0
    • Permissions Management
    • Auditing
    • Teams management
    • Configuring Backup
      • Restoring a backup
    • Activate a workspace license
  • Data Sources
    • Introduction
    • User Apps
    • Workspace Integrations
    • API Integrations
      • Introduction
      • Data Modeling
      • Writing a Connector
      • Access Control
      • API Tokens
      • API Overview
      • Tips
    • Supported File Types
    • Curiosity CLI
      • Installation
      • Authentication
      • Commands
  • Search
    • Introduction
    • Languages
    • Synonyms
    • Ranking
    • Filters
    • Search Permissions and Access Control
  • Endpoints
    • Introduction
    • Creating an endpoint
    • Calling an endpoint
    • Endpoint Tokens
    • Endpoints API
  • Interfaces
    • Introduction
    • Local Development
    • Deploying a new interface
    • Routing
    • Node Renderers
    • Sidebar
    • Views
  • Artificial Intelligence
    • Introduction
    • Embeddings Search
    • AI Assistant
      • Enabling AI Assistant
    • Large Language Models
      • LLMs Models Configuration
      • Self-Hosted Models
    • Image Search
    • Audio and Video Search
  • Sample Workspaces
    • Introduction
    • HackerNews
    • Aviation Incidents
    • Covid Papers
    • NASA Public Library
    • Suggest a Recipe
  • Basic Concepts
    • Graph database
    • Search Engine
  • Troubleshooting
    • FAQs
      • How long does it take to set up?
      • How does Curiosity keep my data safe?
      • Can we get Curiosity on-premises?
      • Can I connect custom data?
      • How does Workspace pricing work?
      • Which LLM does Curiosity use?
      • What's special about Curiosity?
      • How are access permissions handled?
      • What enterprise tools can I connect?
      • How to access a workspace?
      • How do I hard refresh my browser?
      • How do I report bugs?
      • How do I solve connectivity issues?
      • How do I contact support?
  • Policies
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  1. Endpoints

Creating an endpoint

PreviousIntroductionNextCalling an endpoint

Last updated 2 years ago

Click on the + icon next to the search box to create a new endpoint.

You can write your endpoint logic using the Code area. The response of your endpoint will be given by the value you return from your code (the example above always returns the string "hello word").

There are a few options for you to configure:

  • Endpoint name: This defines the name (and thus the path) of your final endpoint. You can use slashes ('/') to create hierarchy of endpoints (this can be useful for accessing endpoints directly using Endpoint Tokens, which can be scoped to a given endpoint name or path)

  • Cache Duration: Specifies if the application should cache the result of the computation, and for how long. Set to zero to always run the endpoint code on every call. Caching can be useful for endpoints that perform expensive computations and might be called often by your end-users or external APIs - an example could be an endpoint providing daily aggregates or analytics that have to iterate through a large amount of data.

  • Access Control: When being called from within the front-end, endpoints can be restricted to either all logged users, or to only admin users.

  • API style: Curiosity provides two APIs to write your own endpoints - a stable and supported API (i.e. the simplified API in this dropdown), that is very similar to the API exposed by the connector query API. This is the recommended API model to be used for endpoints that do simple queries. For more complex logic, you can use the Advanced API - that provides direct access to lower level APIs.

The methods available in the Advanced API can often change, so make sure to check your endpoints after updating your Curiosity Workspace. You'll see a compilation error warning next to the endpoint name. In doubt, reach out to us to find out how to fix your endpoint if you're missing something.

Once you're done writing your endpoint code, click on Create to deploy it on your application.

Use the Shell to prototype your endpoint, and then convert it to an endpoint.

Accepting data

You can only accept data on your endpoint using the body of the request. This will be available to your endpoint code as a string variable named Body, of which you can use as a string, or deserialize to another type. See the example below on a few ways to use it:

// This example assumes you're using the Advanced API

// Argument to the endpoint is a node identifier (i.e. UID128 type)
var uid = UID128.Parse(Body);

// Argument to the endpoint is a complex class:
public class RequestData 
{
    public DateTimeOffset From { get; set; }
    public DateTimeOffset To   { get; set; }
}

var request = Body.FromJson<RequestData>();