When developing a website or integrating content with an AnQi CMS, it is often necessary to retrieve documents and their related information. One common question is whether it is possible to obtain the detailed content of the category to which a document belongs, especially likecategory.contentSuch field? We can clearly find the answer according to the document provided by AnQi CMS.
To put it directly,Yes, the detail interface of AnQi CMS's document,/api/archive/detailThe document indeed provides detailed content of the category it belongs to, that iscategory.contentField.
When we request data of a specific document through the document detail interface, the returneddataobject will include a field namedcategoryThe child object. ThiscategoryThe object not only contains basic information of the category, such as category ID (id), category name (title), URL alias (url_token) and description (description)et al., what is more important, it also directly provides the 'Content Details' of this categorycontent).
This means that as a user, you no longer need to make additional API requests to obtain the detailed content of this category individually. All key information related to the document and its directly associated categories can be obtained in one go.archiveDetailInterface call is in progress. This design greatly simplifies the development process, reduces the number of server requests, and thus improves the data loading efficiency and user experience.
For example, if you are building an article detail page, you not only need to display the title, content, author, and other information of the article itself, but you may also need to show some introductory text about the category the article belongs to in the page sidebar or footer. At this point,archiveDetailReturned by the interface.data.category.contentField, you can directly retrieve and render the detailed content of these categories without additional callscategoryDetailInterface. This is a very practical feature for building efficient and responsive front-end applications.
In most cases,category.contentThe field will include rich text content of categories, such as detailed introductions formatted with HTML tags, specific page descriptions, etc. This depends on the category settings in the backend management system.内容详情How to fill in. Therefore, when displaying on the front end, it may be necessary to parse or render this part of the content appropriately.
Common Questions (FAQ)
1. If I only need to get the detailed content of the category without any document information, which interface should I use?
If you only need to get the detailed information of a certain category, including itscontentField, rather than needing to associate any specific document, it is more recommended to use the "Get Category Details Interface" provided by Anqi CMS/api/category/detailThis interface is specifically used to retrieve complete data for a single category, which is more direct and efficient.
2.category.contentIs the format of the content fixed? For example, is it always HTML?
category.contentThe content format of the field depends on the editor used by the security CMS backend when editing categories and the actual content input by the administrator.This is usually rich text content containing HTML tags.When displaying in the frontend, it is recommended that you perform safe HTML rendering based on actual content to avoid potential XSS risks.
3.archiveDetailReturned by the interface.categoryDoes the object information complete? Does it include all the fields of the category?
archiveDetailReturned by the interface.categoryThe object includes most of the core fields of the category, such asid,title,description,contentThese are sufficient for most daily usage scenarios. If you need all the fields for classification (including some less commonly used fields), consider combining them.archiveDetailInterface acquisitioncategory_idThen callcategoryDetailInterface acquisition of the complete detailed information of this category.