API Reference
1. Introduction
This section provides a general overview of the system API, including backend metadata and WebAPI functionality. The API is designed to support the core functions of the system, providing efficient and reliable interfaces for frontend, third-party systems, and backend secondary development.
2. Metadata
The metadata section provides definitions and explanations of abstract interfaces for C# backend secondary development, helping developers quickly understand the core logic and extension methods of the system. The main contents of metadata are as follows:
- Interface Definition: Provides abstract interfaces for backend modules, defining input and output specifications for core functions.
- Data Model: Describes the main data structures used in the system and their field meanings.
- Extension Points: Indicates the extension locations supported by the system and their constraints.
2.1. Example
The following is an example of a metadata interface used to describe the abstract interface of the order module:
public interface IOrderService
{
Order GetOrderById(string orderId);
void CreateOrder(Order order);
void UpdateOrderStatus(string orderId, OrderStatus status);
}
2.2. Data Model Example
public class Order
{
public string OrderId { get; set; }
public string ProductId { get; set; }
public int Quantity { get; set; }
public OrderStatus Status { get; set; }
}
public enum OrderStatus
{
Pending,
Completed,
Cancelled
}
2.2. Component List
Using Dotnet CLI to Add Specific NuGet Packages
dotnet add package CMS.Plugin.FlowManagement.Abstractions --version 2.7.1.6
You can replace the package name with any component from the table above, such as: CMS.Plugin.ProductManagement.Abstractions, CMS.Plugin.QualityManagement.Abstractions, etc.
Using Visual Studio Package Manager Console to Install
Install-Package CMS.Plugin.FlowManagement.Abstractions -Version 2.7.1.6
Similarly, replace the package name with the required component package name.
3. WebAPI
WebAPI provides a series of endpoints to support the main functional modules of the system. The following describes the functions of the main modules:
3.1. Interface Description
WebAPI provides unified and standard HTTP interfaces for frontend, third-party systems, and mobile terminals, achieving decoupling from backend services. Designed with RESTful style, it supports JSON data format and completes operations such as user authentication, business data query, creation, update, and deletion.
3.2. Interface List
- Barcode Management
- Flow Management
- Recipe Management
- Inspection Management
- Label Management
- Material Management
- Order Management
- Pallet Management
- Process Management
- Production Management
- Product Management
- Quality Management
- SOP Management
- Traceability Management
- Production Statistics
- Quality Analysis
- Common Extensions
3.4. Error Handling
The API uses standard HTTP status codes to indicate request results and provides detailed error information in the response. Common errors include:
- 400: Request parameter error.
- 401: Unauthorized or invalid token.
- 404: Requested resource does not exist.
- 500: Internal server error.
4. Applicable Scenarios
This API is applicable to the following scenarios:
- Interaction between frontend and backend, such as user login, data display, etc.
- Third-party system integration, such as order synchronization, user management, etc.
- Backend secondary development, extending system functions through metadata interfaces.
- Data analysis and report generation, obtaining required information through batch data interfaces.
5. Notes
- All interfaces must be accessed via HTTPS to ensure data transmission security.
- Please keep the access token safe to avoid leakage.
- When calling high-frequency interfaces, please comply with the system's Rate Limit.