This document provides a series of examples to help you get started with the Bika.ai API and SDK. Each section contains code snippets for common operations, including fetching data, creating records, updating records, deleting records, and using automation.
Before using this Open API, we need to first understand the structure and object hierarchy of Bika.ai.
Space
Node Resources:
Database
Automation
Dashboard
Document
AI Chatbot
……
The Space is your workspace. It encompasses all the node resources we've previously mentioned, including databases, automation facilities, dashboards, and additional components. When leveraging the Open API, data retrieval must be carried out in accordance with this structure.
For instance, if you aim to obtain the database C represented by node B within Space A, the API would be similar to spaceA.nodeB->resoure->databaseB.
Note that the node ID is equivalent to the resource ID; for instance, Node ID and Database ID are the same.
You can access these OpenAPI endpoints using any HTTP client that supports them, such as cURL, Python Requests, Node.js axios, Rust reqwest, and others.
System
Retrieving System Meta Info
curl -X GET "https://bika.ai/api/openapi/bika/v1/system/meta" -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}"
curl -X GET "https://bika.ai/api/openapi/bika/v1/spaces" -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}"
Database
Get Records
Gets a list of records from the specified database. Assuming we know that the ID of the space is {SPACE_ID},and the ID of the database is {NODE_ID}, here's an example of a cURL call:
curl -X GET 'https://bika.ai/api/openapi/bika/v1/spaces/{SPACE_ID}/resources/databases/{NODE_ID}/records' \
-H "Authorization: Bearer {YOUR_ACCESS_TOKEN}"
Creating a New Record
Assume we have obtained the ID of a certain space as {SPACE_ID}, node ID as {NODE_ID}, and database ID always equals to node ID. Here is an example of creating a new record:
curl -X POST "https://bika.ai/api/openapi/bika/v1/spaces/{SPACE_ID}/resources/databases/{NODE_ID}/records" \
-H "Authorization: Bearer {YOUR_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"cells": {
"Name": "New record",
"Description": "This is a new database record"
}
}'
Updating a Record
Assume the record ID is {RECORD_ID}. The example of updating a record is as follows:
Note: This interface needs to be used in conjunction with the "Create Record" or "Update Record" interface. After the attachment is uploaded, a return value (located in the data attribute of the response body) will be obtained. Use this value as the value of the field where the attachment is to be inserted in the record, and write it into the database together through the "Create Record" or "Update Record" interface.
import requests
import json
access_token = "{YOUR_ACCESS_TOKEN}"
space_id = "{SPACE_ID}"
url = f"https://bika.ai/api/openapi/bika/v1/spaces/{space_id}/outgoing-webhooks"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"eventType": "ON_RECORD_CREATED",
"name": "Create webhook",
"description": "Example trigger when a new record is created",
"callbackURL": "https://your - custom - callback - url.com"
}
response = requests.post(url, headers = headers, data = json.dumps(data))
print(response.json())
Through the above cURL and Python examples, developers can more conveniently use the Bika.ai OpenAPI to perform various operations. For more detailed information, please refer to the Bika.ai API documentation.
TypeScript / JavaScript SDK
Bika.ai offers an official TypeScript/JavaScript SDK for convenient object-oriented programming when using Bika.ai's OpenAPI.
Prerequisites
Node.js installed on your machine.
Bika.ai API Token: Sign up on Bika.ai and get your API token from your user settings.
Replace YOUR_EMBEDDED_UI_URL with the actual URL of the embedded Bika.ai UI you created. You can adjust the width and height attributes according to your layout needs.
Conclusion
This Quick Start Guide provides basic examples to help you interact with the Bika.ai OpenAPI and SDK effectively. You can modify and expand these examples as needed for your specific use cases. For more detailed information, refer to the Bika.ai API Documentation.
Collect, track, and analyze customer feedback effortlessly with the NPS Customer Referral Value template. Automate surveys, monitor responses in real-time, visualize insights on the NPS dashboard, and optimize marketing and product improvement strategies. Improve customer satisfaction and loyalty while streamlining feedback management and survey workflows for your team.
Organize and manage your product catalog efficiently with our Product Catalog template. Track product types, attributes, links, and pricing, manage vendor databases and supplier information, categorize and monitor products, and streamline product workflows with reporting and localization support. Perfect for sales, operations, and procurement teams looking to centralize product and vendor management.
Simplify how you collect and manage feedback with the Product Feedback Form template. This all-in-one product feedback management system lets you track feedback, organize feature requests, and monitor bug reports in a centralized database. Gain actionable insights with the feedback dashboard and detailed feedback reports to support faster product updates and continuous improvement. Ideal for product teams seeking an efficient feedback tracker and customer request form.
Plan, organize, and execute internal events and digital content with this Remote Internal Communications Planning Template. Track content progress, manage communications objectives, streamline digital workflows, and enable stakeholder collaboration. Perfect for HR, executives, and remote teams to align projects, review content, and ensure timely delivery of internal communications.
Simplify finance workflows with automated invoice reminders, collection, tracking, and submission. This template streamlines expense reimbursement, enables quick photo uploads, provides a centralized invoice database, and ensures accurate, timely management for finance and administrative teams.
Manage your IT assets efficiently with this comprehensive template. Track equipment, monitor asset status, automate maintenance reminders, and maintain a centralized IT inventory. Perfect for IT managers and asset administrators looking to streamline asset management, improve compliance, and optimize asset utilization.