REST API Resource

The REST API Resource is a fundamental component in TechMaju, enabling seamless integration and interaction with various modules within the application through RESTful endpoints.

Understanding the REST API Resource DocType

Purpose: The REST API Resource allows developers to define endpoints that perform specific operations, such as creating, reading, updating, or deleting resources in TechMaju applications.

Function: This DocType facilitates the definition of HTTP methods (GET, POST, PUT, DELETE), resource paths, and the corresponding scripts or methods to be executed. It enables the setup of custom API endpoints to handle specific tasks and interact with the underlying data models.

Role Required

  • TM Core Developer: Can create, write, and delete REST API Resources.

REST API Resource Fields

Details Tab

Field

Description

HTTP Method

Specifies the HTTP method to be used:

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

Resource Path

Defines the endpoint path for the API resource.

Application

Specifies the application to which the API resource belongs.

API Service

Links the resource to a specific API service.

Active

Indicates whether the API resource is active.

Script (Python)

Contains the Python script to be executed when the endpoint is accessed.

Settings Tab

Field

Description

Name

The name of the setting to be included in the API request.

Type

The type of setting:

  • Request Header

  • Query Parameter

Required

Ensures the setting is included in the API request.

Procedure

  1. Navigate to Develop > REST API Resource.

  2. Adding a New REST API Resource:

    • Click on '+ Add REST API Resource' to open the creation form.

    • Fill in the required fields, including HTTP Method, Resource Path, Application, API Service and Script.

      More about REST API Service →

  3. Configuring the REST API Resource:

    • Define the necessary request headers, parameters, and response formats.

    • Set security and rate limiting options as needed.

  4. Saving and Viewing the REST API Resource:

    • Click 'Save' to store the new API resource.

    • The new endpoint can now be accessed as defined.

Best Practices

  • Test API endpoints thoroughly in a development environment before deploying to production.

  • Use proper authentication and authorization mechanisms to secure API access.

  • Regularly update and document API endpoints to ensure clarity and maintainability.

Discard
Save

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on