When `archive/list` returns `code` as `-1`, what error messages will the `msg` field provide?

Calendar 👁️ 99

When using Anqi CMS for website content management, we often deal with various API interfaces, among whicharchive/listThe interface is the core to obtain the document list. During use, you may encounter interface returnscodeWith-1The situation. At this point, understandingmsgThe information provided by the field is particularly important, as it helps us quickly locate the problem.

Whenarchive/listInterface returnscode: -1This means that the request was not successful, and the specific cause of the failure will bemsgField details are described. The design philosophy of Anqi CMS is to use standardized error codes for some non-specific, flexible description errors, and use-1error codes throughmsgThe field provides a readable and understandable error cause.

Let's discuss some common error messages that the field may provide and their meanings when callingarchive/listthe interface,msgcommon error messages and their meanings that the field may provide:

CommonmsgError messages and scenarios

  1. Missing parameters or incorrect formatThis is one of the most common error types.archive/listThe interface provides a wealth of request parameters, but certain parameters are required in specific scenarios or have strict requirements for data format. If your request is missing necessary parameters or provides parameter values that do not comply with the specifications,msgThe field will prompt you.

    • "Missing required parameter: moduleId"or"缺少必要参数: moduleId"When you try to get the document list, especially when using the filter function or when you need to specify a model, moduleIdThe parameter is indispensable. If the parameter is not provided in the request or its value is empty, you may receive this error.
    • "Invalid category ID format"or"分类 ID 格式不正确":categoryIdThe parameter is used to specify the document category to be queried. If you providecategoryIdAn invalid integer (for example, entered letters or special characters) will be reported by the system.
    • "Module not found"or"未找到指定的文档模型": If you have providedmoduleIdBut if the document model corresponding to this ID does not exist in the Anqi CMS system or has been disabled, this kind of prompt will appear.
    • "Parameter 'limit' format error"or"limit 参数格式错误":limitThe parameter supports two forms: a single number (such aslimit="10")or two numbers separated by a comma,such aslimit="2,10")。IflimitThe value does not match one of these formats,such aslimit="abc"Orlimit="10,a",the system will prompt a format error。
    • "Archive ID is required for related type"or"type=related 时文档 ID 必传": When you settype="related"When trying to obtain relevant documents, the system needs a basic documentidto determine the standard of 'relevant'. If at thisidthe parameters are missing or invalid, you will see this kind of error
  2. No results found for data querySometimes, your request parameters are valid in themselves, but no data matching these conditions was found in the CMS system. Although this is not an error at the code level, it may also be encapsulated in business logic ascode: -1and passmsggive a clear explanation.

    • "No archives found matching the criteria"or"没有符合条件的文档": This usually happens when you have used overly strict filtering criteria (such as,categoryIdspecified an empty category, orqSearched for a non-existent keyword or custom filter parameters resulted in no matches), resulting in no documents being able to match your query request.
  3. Other business logic restrictions or internal errorsIn addition to the above common situations,code: -1It may also cover some other business logic restrictions, or in rare cases, indicate that an unexpected error has occurred within the system.

    • "Access denied"or"无权限访问": Although Anqi CMS provides specific error codes for unlogged/unauthorized situations,1001/1002it may also occur under certain data access or business logic restrictions, possibly-1combined with specificmsgRepresents.
    • "Internal server error"or"内部服务器错误"This type of error message is quite general, usually indicating that the server encountered an unhandled exception while processing your request.This may require checking the server logs or contacting the website administrator.

How to locate and solve problems

When you encountercode: -1The most critical first step when you respond is to read carefullymsgThe content of the field.

  1. Check request parametersAccording tomsgCheck the prompt, compare witharchive/listThe API documentation, check each request parameter you send. Confirm that all required parameters have been provided, and that the parameter types, formats, and value ranges meet the requirements.
  2. Verify data validityIf you have used:id/moduleIdorcategoryIdPlease ensure that the parameters are confirmed to exist and are valid in the AnQi CMS backend. For example, a category may have been deleted or set to hidden status.
  3. Simplify the requestIf the error message is not clear enough, or you have multiple filtering conditions, you can try to simplify the request step by step. For example, use onlymoduleIdGet the list first, confirm there are no problems, and then add graduallycategoryId/order/flagWait for parameters until the specific parameter causing the error is found.
  4. Check the background log: For developers or website administrators, the backend log of Anqi CMS is a valuable resource for troubleshooting.Detailed stack trace information or more specific business logic errors, which are usually recorded in server logs.

By using the above methods, you can usually effectively locate and resolvearchive/listInterface returnscode: -1Problems encountered at the time, ensuring the normal display of website content.


Frequently Asked Questions (FAQ)

1. Why does Anqi CMS usecode: -1To represent errors, rather than defining a unique error code for each one?

Adopting AnQi CMScode: -1CombinemsgThe way of field is mainly to provide greater flexibility.Different errors may arise from a variety of complex situations, and if a unique error code is defined for each subtle error, the error code list will become very large and difficult to maintain.code: -1Indicates a "general error" status, then place the specific, readable error description inmsgIn the field, it not only makes it convenient for developers to quickly understand the problem, but also reduces the memory burden of error codes, making error handling more concise and efficient.

2.msgWill the field always provide detailed error information? IfmsgWhat should I do if the field is empty or the information is unclear?

In most cases, Anqi CMS will try tomsgProvide clear error messages. However, in some extreme or unexpected internal error scenarios,msgThe field may be quite general, even possibly empty (although this is rare). IfmsgInformation is unclear, please first check that all request parameters are in full compliance with the document requirements and try to simplify the request.If the problem still exists, the most effective way is to check the operation log of the security CMS server, as lower-level error information is usually recorded there.At the same time, you can also refer to the official documentation of Anqi CMS or seek community support.

3. Besidesarchive/listThe interface, other API interfaces of AnQi CMS will also return an error when an error occurscode: -1?

Yes, according to the Anqi CMS API documentation,code: -1As a general error code forarchive/detail,archive/publish,archive/filtersand this is common in most business interfaces. This means that when you are handling the Anqicms API response, you can follow the same error handling logic: first judgecodeIs it0(Successful), if not, then pay attentioncodeThe specific value (such as1001Not logged in,1002Not authorized), forcode: -1the situation, then further analysismsgfield to obtain detailed error reasons.

Related articles

How to combine the filtering conditions obtained from `archiveFilters.md` and apply them to the custom filtering parameters of `archive/list`?

In Anqi CMS, efficiently managing and displaying website content is the key to improving user experience.When the amount of content grows, providing flexible filtering functions is particularly important to help visitors quickly find the information they need.The AQ CMS provides powerful API interface support, by cleverly combining the filtering conditions obtained from the `archive/filters` interface and applying them to the custom filtering parameters of the `archive/list` interface, we can build extremely practical content filtering functionality.###

2025-11-09

How to determine the visibility or review status of the document from the `archive/list` interface?

In AnQi CMS, one of the core aspects of content management is the control of document status, which directly relates to the visibility and review process of website content.When you retrieve the document list through the `archive/list` interface, the `status` field in the returned data assumes this critical responsibility.Understanding the meaning of this field can help you manage website content more efficiently and ensure that information is presented correctly to visitors.### `status` field

2025-11-09

Is the `created_time` and `updated_time` returned by the AnQiCMS document list a Unix timestamp, and how do I convert it to a readable date?

When using AnQiCMS, we often retrieve detailed information or lists of documents or other content from the API interface.In these returned data, `created_time` (creation time) and `updated_time` (update time) are two very critical fields.Many users may be curious, what are these values that look like a string of numbers?They are actually standard Unix timestamps. ### Understanding Unix Timestamps Unix timestamp, also known as Posix time

2025-11-09

How to use the `type=related` mode in the AnQiCMS document list interface to get related articles?

In website content operation, providing users with relevant article recommendations is an important strategy to enhance user experience, extend visit duration, and optimize content discovery.The AnqiCMS document list interface (`archive/list`) provides a very convenient feature, which can be easily achieved by setting the `type=related` parameter.### Understanding the `type=related` mode After a user has finished browsing a document (article, product, etc.), they usually want to find more information that is thematically similar and complementary to the current content.

2025-11-09

How to efficiently extract and display the article summary (description field) from the AnQiCMS document list?

It is crucial to provide clear and attractive summaries for articles on the website in content management.This not only helps search engines better understand the page content and improve inclusion and ranking, but also quickly captures the attention of visitors on list pages, search results pages, or social sharing, guiding them to click and read the full content.AnQiCMS (AnQiCMS) provides a variety of flexible ways to manage and retrieve this content, and efficiently extracting and displaying the article summary (`description` field`) is a common need in our daily operation. AnQiCMS

2025-11-09

What is the role of `url_token` in the AnQiCMS document list results, and how is it used to generate friendly URLs?

In AnQiCMS, `url_token` is a crucial concept, it is not only a field in the document list, but also the core element for building friendly URLs (Friendly URL) of the website.Understanding its role and usage can help us better optimize the website structure, improve user experience, and search engine rankings.

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

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