What is the difference between the interface for getting document parameters (`archiveParams`) and the interface for getting document parameter filtering conditions (`archiveFilters`)?

Calendar 👁️ 75

When using AnQiCMS for website content management, we often need to deal with API interfaces related to documents. Among them,archiveParamsandarchiveFiltersThese interface names sound similar at first hearing, both are related to "document parameters", but they have completely different functions and usage scenarios in actual applications.Understanding the differences between them can help us develop and manage websites more efficiently.

Deep understandingarchiveParamsInterface: Get detailed parameters of a specific document

Imagine you are browsing a product detail page, besides the basic information such as product title, description, and images, you also want to see additional information such as 'brand', 'material', 'suitable population', which are customized by the backend. At this time,archiveParamsThe interface is put to use.

archiveParamsThe purpose of the interface is.The actual value of the custom parameters set for a specific document (archive). It requires you to provide a unique identifier for the document, typically the document ID (id). When you call this interface and specify a document, it will return the names of all custom fields, the actual values entered, and the default values.

For example, if you have customized the "author" and "city" fields in your article model, when you retrieve an article with ID 123,archiveParamsYou may receive such information:

  • The "author" field, its value is "AnQi CMS Team"
  • The "city" field, its value is "Beijing"

The 'author' and 'city' here are the custom content you enter while editing this specific article.This interface is usually used to display detailed information about a single document on the front-end, supplementing those non-standard fields.You can choose to use an ordered array(sorted=true)or unordered objects(sorted=falseThese parameters are retrieved in the form so that they can be flexibly traversed or accessed directly in the template.

In simple terms,archiveParamsIt's like looking at the 'flyleaf' of a book, which tells you what unique information this particular book has.

Deep understandingarchiveFiltersInterface: Get the filtering conditions of the document module

AndarchiveFiltersThe interface has a completely different responsibility. It does not focus on the parameter values of a specific document, but ratherProvide a list of available filtering conditions for a document model (module). Imagine you are on the product list page of an e-commerce website, where you typically have options like 'Brand Filter', 'Price Range Filter', 'Color Filter', etc.These filtering conditions themselves are passed througharchiveFiltersobtained through the interface.

archiveFiltersThe interface requires you to specify a model ID (moduleIdIt will return all the custom fields marked as filterable under the model, as well as the option lists that these fields may contain.For example, if you have a "job recruitment" model that defines "city" and "education" as filterable fields, then you callarchiveFiltersPass the ID of the model, and you will get:

  • A filter named "City" that includes options such as "Beijing", "Shanghai", "Chongqing", and so on.
  • A filter named 'Education' including options such as 'Master', 'Bachelor', 'Junior College', etc.

These returned 'cities' and 'education' options are not the specific content of a single recruitment document, but you can use them throughout the 'Job Recruitment' module to filter document listsGeneral condition. Front-end developers will use this information to dynamically build filter menus, after the user clicks on these options, then combinedarchiveListthe interface to request document lists that meet the conditions.

In plain language,archiveFiltersIt's like the 'classification label system' in a library, which tells you how all the books in the library can be searched by categories and themes.

Summary of the core differences

  • Focus on different objects: archiveParamsFocusa single documentCustom information;archiveFiltersFocusFilter conditions of all documents under a certain document model.
  • The returned content is different: archiveParamsThe returned is specific document'sActual parameter value;archiveFiltersThe one returned is the document model that can be used for filteringField definition and option list.
  • Different application scenarios: archiveParamsGenerally used forDocument detail pageDisplay;archiveFiltersGenerally used forDocument list pageBuild a filter or search interface.
  • The request parameters are different: archiveParamsDependencyidorfilenamePositioningSpecific document;archiveFiltersDependencymoduleIdPositioningDocument model.

Understanding the distinction between these two allows you to plan the front-end and back-end interaction logic of AnQi CMS more clearly, whether it is to display detailed document content or build flexible filtering functions, you can do so with ease.


Frequently Asked Questions (FAQ)

1.archiveParamsCan the interface be used to filter the document list?No.archiveParamsThe design of the interface is to obtain the detailed custom parameters of a single document, it does not have the function of filtering multiple documents. If you need to filter a list of documents based on the value of a custom field, you should usearchiveListInterface, and cooperate with its supported custom filtering parameters.archiveFiltersThe interface can tell you.archiveListWhat custom filtering parameters and their optional values the interface supports.

2. WhyarchiveFiltersAmong the filtering options returned by the interface,totalAre the values in the field all 0?In the document example you provided,totalThe field displays as 0, which usually indicates that the interface does not count the number of documents under each filtering option in real-time when returning the filtering condition structure. In actual project use, the front-end may call these filtering conditions after obtaining them.archiveListInterface (usually passed intype=pageand setlimitas 0 or 1 to count the number of documents matching each filter condition, thus displaying numbers like “(50)” next to the filter.

3. How can you know if a custom field can bearchiveFiltersretrieved through an interface?retrieved through an interface?archiveFiltersThe interface retrieves it, depending on whether the field is marked as 'filterable' in the AnQi CMS backend model settings. Only fields set as 'filterable' will appear inarchiveFiltersThe result appears, as an option for users to perform filtering operations on the frontend.

Related articles

How to configure custom fields in Anqi CMS so that they can be used as filter conditions?

In AnQi CMS, configuring custom fields as filter conditions is a very practical feature to make your website content more dynamic and interactive.It can help users quickly find the content they need based on specific attributes, thereby significantly improving the user experience of the website.Next, let's learn how to implement this feature in AnQi CMS. ### Custom Field: The "Alive" Tag of Content Firstly, we need to understand what a custom field is.

2025-11-09

How to apply the filtering conditions obtained from the `archiveFilters` to the `archiveList` interface for document filtering?

In AnQi CMS, implementing the dynamic filtering function of documents is a key step to improve the user experience of the website.This usually involves close collaboration between two core interfaces: `archiveFilters` is used to obtain available filtering conditions, while `archiveList` is responsible for retrieving and displaying the corresponding document list based on these conditions.A deep understanding of how they work together can help us build flexible and user-friendly content filtering mechanisms for websites.### Understanding the Filtering Mechanism: From Definition to Discovery Imagine that your website has published a large number of articles

2025-11-09

Why does the `total` field often display as 0 in the `archiveFilters` returned data? What is its real purpose?

When using AnQi CMS for website content management, we often deal with various API interfaces.Among them, the `archiveFilters` interface is an important tool for obtaining document filtering conditions.Many users notice that when using this interface, the `total` field in the `items` list of the returned data always displays as `0` for each filter option (such as `Beijing` and `Shanghai` under `City`).This may be confusing: Since it's a 'quantity', why is it `0`? This

2025-11-09

How to interpret the `items` array in the filtering conditions API, used to build the front-end filter?

In modern web design, the content filtering feature has become an important part of improving user experience and content discoverability.A well-designed filter can help users quickly locate the information they are interested in, whether it is products, articles, or any other form of content.For Anqi CMS, the provided filtering conditions API (/api/archive/filters) is the foundation for building such frontend filtering functions.Especially the `items` array in the response data is the key to understanding and implementing dynamic filtering.

2025-11-09

In what scenario should `archiveFilters` be used instead of `archiveParams`?

During the development and content management of Anqi CMS, we often need to obtain relevant information about documents (Archive).Among them, `archiveFilters` and `archiveParams` are two API interfaces closely related to custom fields, but their design purposes and application scenarios are different.Understanding the difference between them can help us build website features more efficiently and enhance the user experience.First, let's briefly understand the core functions of these two interfaces.

2025-11-09

Does the `archiveFilters` interface support retrieving filtering conditions based on a specified category ID?

When using Anqi CMS for website content management, flexibly obtaining and displaying filter conditions is a key link in improving user experience.Many friends may wonder when using the `archiveFilters` interface whether it supports retrieving filtering conditions based on specified category IDs to provide more accurate filtering options for different categories.Today, let's delve deeply into this issue.

2025-11-09

What would the `archiveFilters` interface return if a document model does not have filterable custom fields?

In Anqi CMS, the `archiveFilters` interface is a very practical feature that allows us to retrieve the filtering conditions of specific document models, thereby helping users to implement flexible content filtering on the front-end page.For example, on a product display page, we may need to filter products based on attributes such as 'color', 'size', or 'brand'. What if a document model is exactly configured without any filterable custom fields, what will the `archiveFilters` interface return?

2025-11-09

How to properly handle the error codes returned by the `archiveFilters` interface (such as -1, 1001, 1002)?

During the operation and development of the website, we often use various API interfaces provided by Anqi CMS to dynamically obtain and display content.Among them, the `archiveFilters` interface plays an important role, helping us to obtain the document filtering conditions, thus providing users with a more refined content browsing experience.However, correctly handling the error codes returned by any API is crucial to ensure the stable operation of the website and a smooth user experience.

2025-11-09