CRUD APIs

This powerful feature allows users to effortlessly create basic CRUD (Create, Read, Update, Delete) APIs for any database model. This functionality enables users to quickly generate endpoints to manage their data models without needing to write extensive code. By streamlining the development process, it allows for rapid setup and efficient management of data operations, saving time and reducing complexity for developers.

Steps to create CRUD APIs from Template

  • Navigate to the APIs listing page from Application Layer -> APIs.

  • Click on the Create API button on the top right corner.

  • Select the Browse Template option from the dialogue box.

  • Select the Entity CRUD APIs option.

  • Enter the Database collection.

  • Select the APIs to be created.

  • Accordingly the Models to be created.

  • Click on finish to generate the starter APIs and models.

You can then customise and edit any APIs that are created via Templates

How to customise APIs

The starter template that Cosmocloud provides contains six APIs and five models.

Initially, APIs and models will be created in ‘Draft’ state. You can edit them in the Workflow builder to add more customisations.

GET

  • This method allows you to retrieves a list of all items in the database.

  • This method also supports pagination through limit and offset parameters.

    • Limit: Specifies the maximum number of items to be returned in a single request.

    • Offset: Specifies the number of items to skip before starting to collect the result set.

GET BY ID

  • This method retrieves a specific item's details based on the provided ID.

  • It requires the ID as a parameter to identify the item.

  • It returns detailed information about the item, including all relevant fields stored in the database.

POST

  • This method allows the creation of a new item in the database.

  • It requires item details to be provided in the request body.

  • It validates the provided data to ensure it meets the required criteria before creating the item.

  • It returns the ID of the newly created item.

PUT

  • This method allows to replace the existing item in the database with new item.

  • It requires the item ID to identify the specific item to be replaced.

  • It requires item details to be provided in the request body.

  • It validates the provided data to ensure it meets the required criteria before creating the item.

PATCH

  • This method allows partial updates to an existing item in the database.

  • This method requires the item ID to identify the specific item to be modified.

  • It requires only the fields to be updated to be provided in the request body, allowing for partial changes without affecting the entire item.

  • It validates the provided data to ensure it meets the required criteria before applying the updates.

DELETE

  • This method allows the removal of an existing item from the database.

  • It requires the item ID to identify the specific item to be deleted.

  • It permanently deletes the specified item from the database.

  • It returns a confirmation message indicating the successful deletion of the item.

Last updated