Getting Started

Introduction:

Welcome to the Operand API! This API is the core of what we offer and it is how we build all of our own products. Any and all feedback is welcome to help improve documentation or the endpoints themselves and can be sent here!

At a high-level Operand provides the infrastructure and API to turn your static knowledge/data/information into dynamic natural language features and our world-class infrastructure enables lightning-fast experiences everywhere.

Using the API:

Host:

The API is accessible at https://prod.operand.ai.

Format:

The API a standard REST API, and uses JSON-encoding for both request and response bodies.

Authorization:

All requests must include an Authorization header with an API key, which will be accessible from your serverless dashboard.

Errors:

Standard HTTP Errors are provided with descriptive messages and an additional error code for support purposes.

First Steps:

Assuming you have an API key you can get started right away!

Step 0: [Optional] Create a Collection Object

We highly recommend beginning by creating a Collection Object so that you can keep your project organized. Collections act as folders in our Object tree structure and it will be much easier to maintain and use your project by using them. That said feel free to ignore us but if you make a mess you might have to clean it up.

const col = await operand.createObject({
  type: "collection",
  metadata: {},
});

Step 1: Add Objects

Assuming you followed our advice you can use your Collection Object’s id as the parent parameter, if you decided to be naughty you can just leave it empty. Feel free to add any type of object you like we have provided a lovely example below for adding some text as an Object.

const textObj = await operand.createObject({
  type: "text",
  metadata: {
    text: "The FitnessGram PACER Test is a multistage aerobic capacity exam.",
  },
  parent: col.id, // optional
});

Step 2: Perform an Operation

Now that we have an Object (or maybe more) we can do the fun stuff: Operations. Operations are how you interact with the objects and create the magical experiences for your users. While there are lots of Operation variants we will use /search and the variant contents allowing us to get content-based semantic search results from our Objects.

const results = await operand.searchContents({
  parentIds: [col.id],
  query: "How to assess fitness?",
  max: 10,
});

Step 3: ????

Step 4: Profit

Go make awesome features and let us know so we can write a case-study!