Skip to content
Talk to our solutions team

Data API Overview

Data API block allows developers to create REST, GraphQL, gRPC, and OData APIs without writing any code. Developers define the APIs required through YAML for 90% of the cases. If there are specific cases where more control is needed, they can extend the service with few lines of JavaScript or WASM.

Data API block does not generate any code. It creates required API endpoints at run-time based on the YAML files and configuration. Read more about our views on Model-Driven Development (MDD). This makes it faster to develop and easier to deploy.

Datastore is a logical grouping of enums, embeddables and entities. Every datastore is tied to a database.

Enums allow developers to define list of values. Entities can have one more fields with data type as enum.

# enum for week days
enums:
- name: weekdays
values:
- value: Sunday
- value: Monday
- value: Tuesday
- value: Wednesday
- value: Thursday
- value: Friday
- value: Saturday

Embeddables are like entities, but do not have real tables or collection. They work like entities for validations and computed fields but cannot exist without entities. They are useful to create validated nested structures as JSON objects in relational table or as nested document in NoSQL collections.

embeddables:
- name: pincode
fields:
- name: pincode
type: string
validations:
- type: required

Traits are way to group together common features that entities should have, like common fields with validations. Developers apply traits to entities with the inherits definition.

kisai-standard.yaml

namespace: kisai
traits:
- name: id
fields:
- name: id
type: ulid
defaultvalue: ulid()
validations:
- type: required
- type: unique
message: id field needs to be unique
- type: final
message: id field cannot be updated

Data types are the categories of data values that can be stored, processed, and retrieved by a programming language. Common data types include numbers (integers, floats, complex), characters (single characters, strings), booleans (true/false), dates, times, and null/undefined values.

Having a universal type system allows for each integration between various services across technology stacks, programming language, and system boundaries.

Entities are foundational blocks of building datastores and APIs. Each entity is mapped to a table in a relation database and to a collection in a Document database.

ticket.yaml

entities:
- name: ticket
inherits: kisai.id
fields:
- name: name
type: string
validations:
- type: required # validation marking the field as mandatory
message: name is a required field # error message to send when validation fails
- name: description
type: string
- name: duedate
type: date
- name: priority
type: priority
- name: state
type: string
stateflow: ticketflow

In kis.ai, we introduce a powerful feature called stateflows, which function similarly to state machines. Stateflows are assigned to fields within an application, defining the finite set of values a field can hold and the specific order in which these values can be transitioned.

stateflows:
- name: ticketflow
initial: Open
states:
- name: Open
on:
START:
target: accepted
- name: In Progress
on:
RESOLVE:
target: Resolved
- name: Resolved
on:
CLOSE:
target: Closed
REOPEN:
target: Open
- name: Closed
type: final