Database modeling is the most crucial part of your API builder project. Models are the foundation of what your database API will look like, and our instant API platform automatically generates both GraphQL tools and REST API tools based on your design.
A model represents an entity of your business logic. For example, if you are making an e-commerce website using our API management platform, your model names could be Product
, User
, Order
, Report
, Shop
etc. Our build API tool will automatically create corresponding GraphQL API and REST API endpoints.
To create a model using our API builder, first click on the Models
from the top navigation bar and click on the button on left side called CREATE A MODEL
. Our instant API builder will guide you through the process.
You will see a page like below. Enter your model name and click CREATE MODEL
. Our build API tool will create the database schema and automatically generate GraphQL tools and REST API tools. You will see a success message afterwards.
Click on the model from the left side menu in-order to add fields to a model. You will see a button appear in the body of the page called ADD A FIELD / RELATION
. Click on that button
to add fields to your model. Choose your relevant field type ( Text
, Number
, Date
, Dynamic List
etc) and fill up the necessary fields and click create.
In order to add relations between models click on the ADD A FIELD
button or choose Relation
from the left side of the side panel. You will see options like the picture below.
In order to a relationship betweend models you have to configure Forward
and Backward
relationship. For example, If you are creating a relations between a products and category,
Forward Relationship for that particular case could be Products Has Many Categories and Backward Relationship could be Categories Has Many Products This is also known as Many-to-Many Relationship
Known As (Optional) field is there if you ever need to overwrite a relationship name in the api. For example if you have two relationship with the same model, lets say, For a project management application a project model could have multiple relationship with user model. One could be an assignee and other could be a reporter. You can use this field to assign different name to your relation. Or else you cant have two different relationship with the same model.