What do the `module_id` and `category_id` fields represent in the document details, and can you further query model or category details through them?

Calendar 👁️ 91

Reveal the details of the Anqi CMS document inmodule_idandcategory_idWhat do they really mean?

When using Anqi CMS for content management and website operation, we often obtain various data through API interfaces, including the document detail interface (/api/archive/detailIt is the key to obtaining the core information of a single article. You may notice this in the returned data of the interface.module_idandcategory_idThese fields. They may seem to be just ordinary numeric IDs, but in fact, they are important clues for understanding the structure of the content and for efficient data operations.

Next, let's delve into the meanings of these fields and how they help us better utilize the Anqi CMS for content operation.

module_id: The 'ID card' of the content model

In AnQi CMS,module_idRepresents the 'Content Model ID' of the document. The content model is the foundation of AnQi CMS flexibility, defining the basic structure and expandable fields of a category of content.For example, you might have a "article" model to publish news and blogs, a "product" model to display goods, and even a "case" model to present project experience.Each model has a unique ID.

From the document details interface (/api/archive/detail) we can see thatmodule_idthe field clearly indicates which content model the current document belongs to. For example:

{
  "code": 0,
  "data": {
    "id": 1,
    "title": "欢迎使用AnqiCMS",
    "module_id": 1, // 这里就是文档模型ID
    "category_id": 1,
    // ... 其他文档信息
  },
  "msg": ""
}

Heremodule_id: 1It may represent the 'article' model. Understanding this is crucial for our subsequent data operations.

Then, thismodule_idCan it be used to further query the details of the model?

The answer is affirmative! AnQi CMS provides the 'Get Model Details Interface' (/api/module/detail), and you can fully use the information obtained from the document details.module_idUsed as a request parameter to query specific information about the model. This includes the model name (title), the additional table name (table_name), and most importantly - all the custom fields defined under the model (fieldsThese custom fields define the unique attributes of the content, such as 'product model' may include 'price', 'inventory', etc., and 'article model' may include 'author', 'source', etc.

In this way, you can dynamically understand the structure of any document and build a more flexible frontend display or perform more refined data processing. For example, you can according tomodule_idRetrieve model details and then render the unique filtering conditions of the model (such as through/api/archive/filtersan interface, which also needsmoduleIdparameters).

category_id: Navigation card of content categories

withmodule_idsimilar,category_idThe field indicates the "Category ID" of the document. Categories are the basic way of organizing content, which helps us to organize a large amount of content, making it convenient for users to browse and find.Under a content model, there can be multiple categories, and the categories can form a hierarchical relationship (for example, under the "News" category, there can be "Company News" and "Industry Dynamics" subcategories).

Let us take another look at the returned data of the document details:

{
  "code": 0,
  "data": {
    "id": 1,
    "title": "欢迎使用AnqiCMS",
    "module_id": 1,
    "category_id": 1, // 这里就是文档分类ID
    "category": {     // 注意,这里已经包含了分类的详细信息!
      "id": 1,
      "parent_id": 0,
      "title": "AnqiCMS帮助",
      "seo_title": "",
      "url_token": "goruning",
      "module_id": 1,
      // ... 其他分类信息
    },
    // ... 其他文档信息
  },
  "msg": ""
}

Herecategory_id: 1Points to the category 'AnqiCMS Help'.

Then, thiscategory_idCan it be used to further query category details?

Here is a very practical detail: in the document detail interface of Anqi CMS, it returns thedatain fact, it has alreadydirectly contains the complete information of the document category, namelydata.categoryobjectThis means that you usuallydo not need to make an additional API requestto get its details (such as through/api/category/detailInterface). All categories, SEO information, URL aliases, and even the ID of the model they belong to are included (module_id) and the parent category ID (parent_id) are all there.

However,category_idIt is still very useful! If you want to:

  • Get the list of other documents in the same category:You can use thiscategory_idasarchiveListinterface'scategoryIdparameter to easily get other relevant documents in the same category.
  • Get all subcategories of a category:You can usecategory_idascategoryListinterface'sparentIdparameters to build a complete category navigation structure.

In summary,module_idandcategory_idIt is the core positioning identifier in the Anqi CMS content system.module_idHelp you understand the structure of the content and custom attributes, whilecategory_idIt is responsible for the classification and navigation of content. They collectively constitute the powerful and flexible content organization capabilities of Anqi CMS, allowing developers and operators to accurately obtain and display content according to specific needs.


Frequently Asked Questions (FAQ)

1.module_idandcategory_idfield inarchiveDetailIs it a must in the interface return?

Yes, these two fields are inarchiveDetailThe returned data from the interface is the core attribute of the document, indicating the model and category to which the document belongs, which usually exists. If the document is not assigned a category,category_idIt may be a default or empty value, but it is not common in practice because categorization is the basis of content organization.module_idIt is almost always present, determining the content type of the document.

2. Can I search or filter documents according tomodule_idorcategory_idto search or filter documents?

Absolutely. Anqi CMS'archiveListThe interface (get document list) supports filtering throughmoduleIdandcategoryIdAs a request parameter to filter documents. This means you can easily obtain all documents under a specific model or category, which is very useful for building category pages, special topic pages, or content aggregation.

3.archiveDetailThe interface has returned andata.categoryobject, why do I still needcategory_idThis independent field? Is it redundant?

data.categoryThe object indeed provides a complete detail of the current document category, avoiding the need for a separate query, which is to facilitate your access to all information of this category.category_idExists as an independent integer field, mainly for the convenience of indexing, querying, and parameter passing. For example, when requestingarchiveListorcategoryListan interface, directly pass an integer typecategoryIdIt is more efficient and concise to pass a complete classification object. They each have their own roles, complementing each other.

Related articles

What role does the `url_token` field play in the document details, and how is it associated with the `filename` parameter?

In the daily use of Anqi CMS, we often encounter the `url_token` field, especially when dealing with document details and URL structures.It is closely related to the `filename` parameter in the API interface. Understanding the relationship between the two is crucial for better management of website content, optimizing user experience, and improving search engine performance.### `url_token`:The "friendly" identity tag of content `url_token` is simply the term used in the AnQi CMS system for various types of content (such as documents

2025-11-09

How to get the SEO title (`seo_title`), keywords (`keywords`), and description (`description`) of a document?

In website operation, setting clear and targeted SEO titles (`seo_title`), keywords (`keywords`), and descriptions (`description`) is a key step in improving search engine rankings.AnQiCMS (AnQiCMS) provides a convenient way to manage and obtain these important SEO metadata.Whether you need to dynamically set this information for a single page or process a large amount of content in bulk, it can be easily achieved through the provided API interface.

2025-11-09

What are the common meanings of the `code` and `msg` fields in the document details interface?

When using AnQiCMS for website development or integration, we often deal with API interfaces.When handling the return results of these interfaces, the `code` and `msg` fields are almost indispensable parts of all response data.They play the role of 'traffic lights' and 'instruction manuals', helping us quickly understand the processing results of the request, whether successful or not.### `code` field: Quickly judge the status code of the request result The `code` field is an integer value

2025-11-09

How to extract the complete content of the document from the returned data of the document detail interface?

In website operation, we often need to dynamically obtain and display the articles or product details of the site.AnQiCMS (AnQiCMS) provides a powerful and flexible API interface, making this process very convenient.Among them, the interface for obtaining document details is one of the core ones, which not only returns the basic information of the document but also allows you to easily obtain the complete content of the article.This article will guide you on how to accurately extract the complete content of the document from the document detail interface return data of Anqi CMS.

2025-11-09

How to get the current view count (`views`) and comment count (`comment_count`) of the document?

When operating a website, understanding which content is more popular and which topics can spark discussion is crucial for optimizing content strategy.AnQiCMS (AnQiCMS) provides us with a convenient way to obtain this key data, such as the number of page views and comments on articles.Let's take a detailed look at how to obtain this information through the Anqi CMS API interface.

2025-11-09

How is the `images` field (document group image) stored and parsed in the document details?

When using AnQiCMS to manage website content, images are undoubtedly an important element in enhancing the attractiveness of the content, especially when we want to add a series of related images to the document, the album feature becomes particularly crucial.So, how are these group images stored and parsed in the AnQiCMS document details?Understanding this will help us better utilize AnQiCMS for content creation and display.### The storage mechanism of document group charts First

2025-11-09

What do the `logo` and `thumb` fields represent in the document details, and what is the difference between them?

When managing content in Anqi CMS, we often encounter questions about image fields, especially the `logo` and `thumb` fields, which are both involved in image representation in the document detail interface (`archiveDetail`), but have subtle yet important differences in actual use and meaning.Understanding their differences can help us better optimize the visual presentation and loading performance of the website.### `logo` field: the "identity card" of the document When we talk about the `logo` field

2025-11-09

How to interpret the `flag` recommended attribute in the document details, for example, what do `h`, `c`, `f`, and others represent?

In AnQi CMS, the recommended attribute `flag` is a very practical feature in content operations. It allows us to classify and label document content, thereby enabling personalized display and filtering in different areas of the website.Understanding the meaning of these brief letter codes can help us manage and present website content more efficiently.Where can I find the `Flag` attribute? This important `flag` attribute appears in several key interfaces, it is both the characteristic of the document itself, and the important basis for querying and filtering documents. First

2025-11-09