When using AnQiCMS to build a website, we often need to provide flexible filtering functions for different types of content, allowing visitors to quickly find the target information according to their needs.archiveFiltersThe interface is exactly for this purpose, it can help us get the document filtering conditions. And in this interface,moduleIdthe parameter plays a crucial role.

archiveFiltersin the interfacemoduleIdDetailed explanation of the parameter's role

When our website contains a variety of content types, such as 'articles', 'products', and 'service cases', AnQi CMS will use 'models' to differentiate and manage these different types of content.Each model can have its own unique fields, such as, the 'Product' model may include 'Color', 'Size', 'Brand', and other fields, while the 'Article' model may only have 'Author', 'Publish Date', and other such fields.These custom fields are the basis for our content filtering.

archiveFiltersThe function of the interface is to return a list of all custom fields and their corresponding optional values under the specified “model”, which can be used for filtering.moduleIdThe parameter comes into play.

To be specific,moduleIdThe parameter is used toExplicitly specify the filtering conditions for the content model you want to retrieve. It is an integer representing a specific content model (for example,moduleId=1it could be an article model,moduleId=2It may be a product model).

Give an example, suppose your website has a "Recruitment InformationmoduleIdSet to 100. When you need to display these recruitment information filters on the front page, you can callarchiveFiltersthe interface, and pass inmoduleId=100. The interface will be based on thismoduleIdAccurately return the two filtering dimensions of "city" and "education level", as well as their respective options (such as city: Beijing, Shanghai; education level: Master, Bachelor, etc.).

If notmoduleIdThis parameter, the system will not know which type of content you want to get the filter conditions for.Because different content models, their custom fields and filtering logic may be completely different.moduleIdEnsured that the interface returns the filtering conditions arehighly relevant and accurateThe, avoids incorrectly applying the 'product' filter conditions to 'article' content, thus greatly improving user experience and data processing efficiency.

It acts like a signpost, telling the CMS: "Please give me all the filter options for this specific content type.”So, your website can dynamically display the most suitable filters for different sections or pages, making content organization and search smarter and more convenient in English.For developers, this also means that it is easier to build flexible and versatile front-end filtering interfaces without hardcoding a large amount of filtering logic.

Common Questions (FAQ)

Q1: Where can I find a specific content model?moduleId? A1: moduleIdYou can check it in the content model management page of the Anqi CMS backend. Usually, each model will have a unique numeric ID. In addition, when callingarchiveListorarchiveDetailWhen obtaining document or category information through interfaces, the returned data will also includemodule_idfield, from which you can obtain the module ID of the corresponding document or category.

Q2: If I callarchiveFiltersThe interface did not providemoduleIdHow will the parameters be? A2:According to the description in the interface document,moduleIdYesarchiveFiltersthe interface'sRequiredParameter.This means that if you do not provide this parameter, the interface will not respond normally, and it will usually return an error message indicating that the necessary parameters are missing, or it will return an error code indicating that the request is invalid.This is to ensure that the system can accurately identify the content model you want to query.

Q3:archiveFiltersThe filtering conditions returned by the interfacearchiveListWhat is the relationship between the custom filtering parameters of the interface? A3: archiveFiltersThe interface returns exactlyarchiveListThe optional parameters in the interface “Custom Filter Parameters”. Simply put,archiveFilterstells you “which fields and options can be filtered”.archiveListThen you can use these fields and options to “actually filter out the document list that meets the conditions”. For example,archiveFiltersMay tell you that the "city" field has options such as "BeijingarchiveListadd in the requestcity=北京Filter documents in Beijing. They are the perfect combination of front-end building filters and back-end executing filter logic.