What is the default behavior and return content of the `archive/list` interface when no parameters are passed?

Calendar 👁️ 94

In-depth analysis of AnQi CMSarchive/listInterface: default behavior and return content without parameters

When using AnQiCMS for website development or content management, we often need to retrieve various data through API interfaces.archive/listThe interface is one of the core interfaces for obtaining the document list of a website. Understanding its default behavior and return content when no parameters are passed is crucial for efficient data acquisition and initial debugging.

Interface address and calling method overview

first, archive/listThe calling address of the interface is{域名地址}/api/archive/listAnd thenGETThe method is used to make a request. When you make a request to this address without any parameters, Anqi CMS will process your request based on its internal preset logic.

The default behavior when no parameters are passed

When you callarchive/listWhen no request parameters are specified, the system will adopt a series of default strategies to determine what content to return and how to organize it.

First and foremost, the most critical point is, the interface'stypeThe parameter will be set tolistThis means that even if you do not explicitly request it, the system will return the document in list form rather than in paginated form. Due totypeDefault tolistother parameters related to pagination, such aspageandq(Search keyword), in this case it will not take effect.

Secondly, the system usually adopts the sorting method for documents.id descThis means that the documents are sorted in reverse order by document ID. This means you will get the latest document, with the documents with larger IDs appearing earlier.

In addition, regarding the classification of the document, if you have not passedcategoryIdspecify the parameter, the system will default to fetching all documents under all categories. At the same time,childThe default value of the parameter istrueThis means that even if you specify a category, the system will also include all the subcategory documents under that category. But if you do not specifycategoryIdUnder the premise, this default behavior is reflected in its covering all models and categories of documents on the website.

Finally, there is a default behavior that needs to be noted, but it is not explicitly mentioned in the documentationlimitof (displayed number). Although not specifiedlimitBut the API usually does not return all documents indefinitely.To ensure the response speed of the interface and the system resource usage, it is very likely that AnQi CMS will apply a default quantity limit internally, such as returning the most recent 10 or 20 documents.The exact number of documents returned may need to be confirmed through actual testing, but it is definitely not all the documents returned.

The structure and meaning of the default returned content

Whenarchive/listWhen the interface is executed successfully without any parameters, you will receive a standard JSON format response.

This response contains three main fields:

  • code: Represents the status code of the request. It is usually successful.0.
  • msg: Provides a text description of the request result. It is an empty string when successful, and indicates the error cause when failed.
  • dataThis is an array containing a series of document objects that meet the default conditions.

Each document object (dataan element of an arrayitemAll of them are very detailed, including almost all the core information of the document, such as:

  • id: The unique identifier of the document.
  • title: The title of the document.
  • seo_title: The SEO title of the document, used for search engine optimization.
  • url_token: The document's URL alias, usually used to generate friendly URLs.
  • keywordsanddescription: The document's keywords and summary, which are also very important for SEO.
  • module_idandcategory_id: Represent the model and classification ID of the document.
  • viewsandcomment_count: Document views and comment count.
  • images,logo,thumb: Document-related image information, such as group images, Logo, and thumbnails.
  • flag: Document recommendation attributes, such as headlines, recommendations, etc.
  • created_timeandupdated_time: Document publishing and update timestamp.
  • status: Document display status.
  • user_id: User ID of the document publisher.
  • priceandstockIf the document is a product, it will also include price and inventory information.
  • extraAn object containing other custom field information of the document, these fields vary according to the model settings.

It is noteworthy that by default,typeWithlistthe successful response will include,Do not includetotalfieldyou cannot directly know the total number of documents that meet the conditions from this request.

the significance in real-world scenarios

Understandarchive/listThe default behavior of the interface when no parameters are passed, which is very useful for quickly previewing the website content and performing preliminary API connectivity tests.It allows you to immediately obtain the latest document list of the website without writing complex parameters, helping you understand the basic structure and content of the data.However, in practical applications, in order to obtain more accurate and business-specific data, it is usually necessary to pass the corresponding parameters according to specific circumstances, such as specifyingmoduleId/categoryId/order/type=pageas well aslimitEqual, in order to achieve precise data filtering and pagination display.

Frequently Asked Questions (FAQ)

  1. Q: How can I retrieve all documents or perform pagination display?A: If you need to retrieve all documents or paginate through them, you need to explicitly settypeparameters forpage. Whentype="page"when youpageandlimitparameters to specify the page number and the number of items per page, and the response will also return an extra onetotalThe field indicates the total number of documents.

  2. Q: Why can I return documents without specifying a category or model? Which documents are returned?A: This is becausearchive/listThe interface does not specifycategoryIdormoduleIdWhen, it will default to fetching documents from all available document models and categories.The content returned is considered "latest" or "default" by the system, which is usually the document sorted in reverse order by ID and applied with the internal default quantity limit.

  3. Q: Why are the default returned data not showingtotalthe field to display the total number of documents?A: By default,archive/listinterface'stypeparameters forlistIn this mode, the API only returns a list of documents and does not provide the total number of documents. If you need to get the total number of documents, you must settypeThe parameter is explicitly set topage.

Related articles

How to get the articles published by a specified user (`user_id`) through the AnQiCMS document list?

In website content operation, we often need to display all articles of a specific author, such as on the author's personal homepage, or on a special topic page aggregating the content of specific contributors.AnQiCMS (AnQiCMS) provides a powerful and flexible API interface, allowing us to easily meet this requirement. To get the list of all articles published by a specified user (`user_id`), we need to use the `archive/list` interface.

2025-11-09

What is the significance of the `price` and `stock` fields returned by the `archive/list` interface for e-commerce document models?

In AnQi CMS, when you retrieve the document list through the `archive/list` interface, the returned data includes the `price` and `stock` fields, which are of vital importance for constructing an e-commerce website model.They are not just simple numbers, but are the core elements supporting product display, transaction process, and inventory management.

2025-11-09

I want to display the number of comments for each article on the AnQiCMS document list page, which field should I check?

In the daily use of AnQiCMS, many operators hope to be able to directly display the number of comments for each article on the article list page.This not only effectively enhances the activity of the content, but also helps users quickly understand which articles are more popular and have more discussion value.Then, among all the data fields, which one should we focus on in order to meet this requirement?

2025-11-09

How to ensure that only documents under the parent category are returned when retrieving the AnQiCMS document list, without including subcategories?

When using AnQi CMS to manage website content, we often encounter situations where we need to precisely control the display range of documents.For example, when you want to display only the documents directly published under a certain parent category page, without involving the content of its subordinate subcategories, you need to adjust the way the document list is retrieved.AnQi CMS provides a very flexible API interface, allowing you to easily meet this requirement.

2025-11-09

How to implement a 'Hot Articles' or 'Most Viewed' list, achieved through the `order` parameter?

In website operation, we all hope to display the most popular and highly read articles to visitors, such as common lists like "Hot Articles" or "Most Viewed".This not only effectively guides users to discover more exciting content and improve the user experience of the website, but it is also an indispensable part of content operation.In AnQi CMS, implementing such a feature is simpler than you imagine, the secret is hidden in the `archive/list` interface's `order` parameter.

2025-11-09

What will `data` and `total` return if no documents meeting the criteria are found in the AnQiCMS document list?

When building a website or application with AnQiCMS, we often need to use its provided API interface to retrieve various content, such as document lists.What data structure will the API return when our query conditions do not match any content?Especially the `data` and `total` fields, which are crucial for our proper data handling.Today, let's delve into how AnQi CMS responds when it does not find a document that meets the criteria in the document list.

2025-11-09

What is the help of `archive/list` interface returned `canonical_url` and `fixed_link` fields to SEO optimization?

In the ocean of website content, how can our high-quality content stand out and be discovered by more potential users, which is a topic that every content operator continuously explores.Search engine optimization (SEO) is one of the key strategies to achieve this goal.In SEO practice, the URL plays an extremely important role.

2025-11-09

How to use the `archive/list` interface to dynamically load more documents on the front end (infinite scrolling)?

In modern web design, infinite scrolling has become a popular content loading method that significantly enhances user experience, allowing visitors to maintain immersion while browsing content without interruption.For users who build websites using AnQiCMS, the `archive/list` interface is a powerful tool to achieve this function.

2025-11-09