Models

A model refers to a blueprint or definition that outlines the structure and constraints of a data model. It provides a set of rules and specifications for how data should be organised and stored within a system.

There are 3 types of Models in Cosmocloud right now -

Database collection model

These define and mirror the database collections (tables / entities) in the system. The name of these models should be exactly the same as the underlying Database collection.

You can check the database model naming convention here. You can easily define these as strings containing [a-zA-Z0-9_] characters and cannot begin with numbers or underscore.

Query params model

Query param models, are structures or schemas that define the expected format and data types of query parameters used in API calls. They serve as a set of rules that guide how query parameters should be constructed and what types of values they should hold when making requests to an API.

Request body model

A "Request Body Model" is a structured definition that outlines the format, structure, and data types expected in the payload of an HTTP request made to an API endpoint. It serves as a blueprint for using HTTP methods like POST, PUT, PATCH, and DELETE. Unlike GET requests that retrieve data, these methods involve sending data to the server for processing .

Request Body has an option set as `extra_fields=forbid` which makes your request bodies strict. Any extra field passed while calling the API, would lead to 400 Bad Request with appropriate error message.

Last updated