Guide
-
1. Quick Start
What is the AnQiCMS API? AnQiCMS is an open-source content management system developed based on the Go programming language, providing a complete API interface for developers to call.The API uses the RESTful design style, supports data interaction in JSON format, and allows developers to interact with the system through HTTP requests to obtain, create, update, or delete content.1.2 API basic concept API basic path: /api - All API requests must be prefixed with this path -
2. API Basic Structure
2.1 API Basic Path and Request Methods All API interfaces are accessed through the following basic path: {domain address}/api/interface path For example: https://en.anqicms.com/api/archive/list The supported HTTP request methods include: GET - Retrieve data POST - Create data or submit a form, update data, delete data 2.2 Authentication Method Some interfaces require user authentication, the system uses JWT Token -
Part Three: Detailed Explanation of API Interface Classification
Here is the API interface classification provided by AnQiCMS, as well as some interface parameters. For more document interfaces and parameter configurations, please refer to the detailed documentation.3.1 Content Management Interface The Content Management Interface is used to handle the core content of the website, including documents, categories, tags, and so on. -
Four, Request Parameter Details
4.1 The API interface supports two parameter passing methods: Query parameters: passed through the URL query string, suitable for GET requests Body parameters: passed through the request body, suitable for POST requests 4.2 Pagination parameter description Most list interfaces support pagination functionality, the common pagination parameters include: Parameter name Type Description page int Page number, default is 1, some interfaces use current as the current page, please refer to the actual interface limit int -
Five, Response Data Structure
5.1 General response format All API interfaces follow a unified response format: { "code": 0, "msg": "success message", "data": {} } 5.2 Data field description Field name Type Description code int Error code, 0 indicates success msg string Error information or success prompt data -
Six, Authentication and Authorization
6.1 JWT Token Authentication AnQiCMS uses JWT (JSON Web Token) for user authentication: After successful user login, obtain the Token and carry it in the Header of subsequent requests in the format: Token: {token} 6.2 Interfaces Requiring Authentication The following types of interfaces require user authentication: User Information Management Interface Order Management Interface Collection Management Interface Comment Publishing Interface Shopping Cart Management Interface 6.3 Token Acquisition and Refresh -
Seven, Debugging and Testing
7.1 Debugging Tools Recommended Postman - A powerful API testing tool curl - Command line tool Browser Developer Tools - View network requests 7.2 Common Errors and Solutions Error: Token expired Solution: Log in again to obtain a new Token Error: Parameter format error Solution: Check parameter type and format Error: Interface has no permission Solution: Confirm user permissions or check authentication information 7.3 Performance Optimization Suggestions -
Eight, Practice
8.1 Interface calling practice Error handling: Always check the returned code value Parameter validation: Validate the validity of parameters before calling Retry mechanism: Implement retry logic for temporary errors 8.2 Security practice Token protection: Properly store the authentication Token HTTPS: Always use HTTPS connections Input validation: Strictly validate user input 8.3 Error handling practice // Example: Error handling practice fetch('/api/archive/list' -
Nine, Blog Site API Call Example
We first analyze the pages of the blog site, and then decompose the interfaces required for each page. -
Ten, Mall Site API Call Example
We first analyze which pages the mall site has, and then decompose the interfaces required for each page.