REST API Service
The REST API Service in TechMaju is used to group and manage multiple REST API Resources, providing a structured way to handle related API endpoints within an application.
Understanding the REST API Service DocType
Purpose: The REST API Service serves as a container for organizing and managing multiple REST API Resources. It ensures a logical grouping of related endpoints for better maintenance and scalability.
Function: This DocType allows developers to define and manage collections of API resources, set security policies, rate limits, and configure other settings at the service level.
Role Required
TM Core Developer: Can create, write, and delete REST API Service.
REST API Service Fields
Details Tab
Field | Description |
|---|---|
API ID | Unique identifier for the API service. |
Application | Specifies the application to which the API service belongs. |
Active | Indicates whether the API service is active. |
Settings Tab
Field | Description |
|---|---|
Name | The name of the setting to be included in the API request. |
Type | The type of setting:
|
Required | Ensures the setting is included in the API request. |
Security Tab
Field | Description |
|---|---|
Allow Guest | Specifies if guest users are allowed to access the API service. |
Rate Limiting Tab
Field | Description |
|---|---|
Enable Rate Limit | Toggle to enable or disable rate limiting. |
Request Limit | The maximum number of requests allowed within the specified time window. |
Time Window (Seconds) | The time window for rate limiting, specified in seconds. |
Procedure
Navigate to Develop > REST API Service.
Adding a New REST API Service:
Click on '+ Add REST API Service' to open the creation form.
Fill in the required fields, including API ID, Application, and other settings.
Configuring the REST API Service:
Define settings like request headers, security policies, and rate limits.
Link the service to the necessary REST API Resources.
Saving and Viewing the REST API Service:
Click 'Save' to store the new API service.
The service can now manage and organize its associated API resources.
Best Practices
Organize API resources logically within services to simplify maintenance and scalability.
Implement comprehensive security measures at the service level to protect API endpoints.
Monitor API usage and adjust rate limits to ensure optimal performance and availability.