Skip to main content

HTTP Reference

OpenAPI

Tigris provides an easy-to-use intuitive API to query database. Setting up the database is instantaneous, as well - no need for tedious configuration. You define the data model as part of the application code, which then drives the database infrastructure without you having to configure and provision database resources.

1. Start Tigris

Install Tigris CLI

Use the command below to install the CLI on macOS

brew install tigrisdata/tigris/tigris-cli

Use the command below to install the CLI on linux

curl -sSL https://tigris.dev/cli-linux | sudo tar -xz -C /usr/local/bin

Alternative ways of installation can be found here.

Start Tigris development environment

tigris dev start

Once this command has completed, Tigris will be available on port 8081.

Getting started →

2. Define data models

curl 'http://localhost:8081/v1/databases/catalogdb/collections/catalog/createOrUpdate' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"schema":{
"title":"catalog",
"properties":{
"id":{
"type":"integer",
"format":"int32",
"autoGenerate":true
},
"name":{
"type":"string"
},
"price":{
"type":"number"
},
"brand":{
"type":"string"
},
"labels":{
"type":"string"
},
"popularity":{
"type":"integer"
},
"reviews":{
"type":"object",
"properties":{
"author":{
"type":"string"
},
"rating":{
"type":"number"
}
}
}
},
"primary_key":[
"id"
]
}
}'

Declaring models →

3. Persist data

curl 'http://localhost:8081/v1/databases/catalogdb/collections/catalog/documents/insert' \
-X POST \
-H "Content-Type: application/json" \
-d '{
"documents":[
{
"name":"fiona handbag",
"price":99.9,
"brand":"michael kors",
"labels":"purses",
"popularity":8
}
]
}'

Insert documents →

4. Query data

curl 'http://localhost:8081/v1/databases/catalogdb/collections/catalog/documents/read' \
-X POST \
-H "Content-Type: application/json" \
-d '{
"filter": {
"brand": "adidas"
},
"options": {
"limit": 1
}
}'

Query documents →

5. Search data

curl 'http://localhost:8081/v1/databases/catalogdb/collections/catalog/documents/search' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"q": "running"
}'

Search documents →

6. Stream events

6.1 Create topic

curl 'http://localhost:8081/v1/databases/catalogdb/collections/order_events/createOrUpdate' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"schema":{
"title":"order_events",
"properties":{
"order_id":{
"type":"integer",
},
"order_name":{
"type":"string"
},
"order_status":{
"type":"string"
}
},
"collection_type": "messages"
}
}'

6.2 Publish message

curl 'http://localhost:8081/v1/databases/catalogdb/collections/order_events/messages/publish' \
-X POST \
-H "Content-Type: application/json" \
-d '{
"messages":[
{
"order_id":1,
"order_name":"order of shoes",
"order_status":"completed"
}
]
}'

Event Streaming →