What does it mean if an error code 1001 or 1002 occurs when getting the document details, and how to solve it?

Calendar 👁️ 94

When using Anqí CMS for website content management and development, we often obtain various data through API interfaces, including retrieving document details (/api/archive/detailThis is very commonly used. When you call this interface, if you encounter system return codes 1001 or 1002, this usually indicates that the request was not successfully processed and specific reasons were given.Understand the meaning and solutions of these error codes, which can help us more efficiently troubleshoot problems and ensure the normal display of website content.

Error code 1001: Not logged in

When you try to get the document details, if the system returns error code 1001, this clearly indicates that your current session has not passed the user identity verification of Anqicms.In simple terms, it is that the system does not recognize who you are, or you have not told the system who you are.

Common cause analysis:

  1. Not logged in:You may not have logged in yet, or the login status of the user has expired in the front-end page/client application.
  2. Session expired: The user had previously logged in, but due to long inactivity or other security policies, the login session (such as the stored Token) has expired and needs to be retrieved again.
  3. Content restricted: You are trying to access a document detail that has been set to 'Visible to logged-in users', but your current request does not carry valid login credentials.

Solution:The most direct solution is to perform user login. Anqi CMS provides a login interface (usually/api/login),Through this interface, after successfully logging in, the system will return a user token (usually a Token). You need to make sure that this Token is correctly attached to the request header in subsequent API requests (for example,AuthorizationField) or send as a request parameter. For a frontend application, this means you need to implement a login process and store the obtained Token securely (such as in LocalStorage or Cookie) so that it can be carried with each request that needs to authenticate the interface.If the Token expires, the user needs to be redirected to log in again to obtain a new Token.

Error code 1002: Unauthorized

The error code 1002 means that although you have logged in and the system has identified your identity, your account does not have sufficient permissions to access the details of the requested document.This is like entering a club, but some VIP areas are not accessible to regular members.

Common cause analysis:

  1. Document permission settings: You may try to access a document that is set by the security CMS background to be accessible only to specific user groups or permission levels (such as VIP content, paid content, internal materials, etc.).
  2. Insufficient group permissions:The user group to which the account you are currently logged in belongs (such as the general member group) has not been granted access to this type of document or a specific document.
  3. Account status abnormal:Your account may be frozen, downgraded, or restricted for other reasons.
  4. Content Paid:If the document is a paid content, you may need to complete the payment first before you can view the details.

Solution:Resolve 1002 error by starting from the permission level:

  • Confirm document permissions:In the Anqi CMS backend management interface, find the document you are trying to access, check its 'reading level', 'access permissions', or related settings, and confirm whether the document is open to all users or only to specific user groups.
  • Verify user group:Check the user group of the current logged-in user account. If the document detail interface requires higher permissions, you may need to upgrade your user group (such as from a regular member to a VIP member), or contact the website administrator to adjust your user group permissions.The AnQi CMS backend user management module usually displays the user group and permissions of the user.
  • Contact administrator:If the above checks do not solve the problem, or you are not sure about the specific permission settings, the most effective way is to contact the website administrator.The administrator can view your account permissions, verify the document access settings, and then make necessary adjustments.
  • Check payment status:If the document is paid content, it needs to go through:archiveOrderCheckThe API to confirm if the payment has been made.

General Troubleshooting Suggestions

Whether you encounter errors 1001 or 1002, the following general troubleshooting steps may be helpful:

  • Please check the API request parameters carefully:Ensure that the document ID or filename you provide is correct and matches the existing document.An incorrect ID or filename may cause the system to be unable to find the document, thereby indirectly causing other errors.
  • View the complete API response information:Anqi CMS usually returns error codes whenmsgProvide more detailed error descriptions to help you quickly locate the problem. For example, prompts such as 'not logged in' or 'insufficient permissions' will appear directly.msgin the field.
  • Check network and server status:Ensure that your network connection is normal and the Aqian CMS server is running stably. Temporary network fluctuations or server maintenance may also cause API requests to fail.

By systematically analyzing error codes, combining the documents provided by Anqi CMS and the backend management features, you can efficiently solve these problems and ensure smooth access to website content.


Frequently Asked Questions (FAQ)

Q1: If the document detail interface does not return an error code, butdatawhat does it mean if the field is empty?A1: This usually means that the API request itself was successful, but the system was unable to find the corresponding document based on the document ID or filename provided.Please check if the document ID or filename you entered is correct, or if the document has been deleted, is in a non-display state (status is not 1), or has not been published.

Q2: Why did everything work fine during local testing, but errors 1001/1002 appeared after deployment to the server?A2: This situation is common. Possible reasons may include: Differences between the server environment and the local environment causing the Token to fail to pass;Cross-domain configuration problem prevents the browser from sending Token;Or the content permission settings on the server are more strict than the local ones.It is recommended to check the Nginx/Apache configuration of the server, the CORS strategy, and the user groups and document permission settings of the Anq CMS backend.

Q3: Is there any other way to manage user access to documents besides manually modifying permissions?A3: Yes. Anqi CMS usually supports user group management functions, you can create different user groups (such as ordinary users, VIP users, administrators, etc.), and configure different access permissions for each user group.Then, when publishing or editing a document, you can specify that the document is only visible to certain or a few user groups, so you can manage document access permissions in bulk without having to set up each user individually.In addition, some paid content modules may also integrate permission management based on payment status.

Related articles

How to get the value of a specific custom field (such as "author") through the `extra` field?

In Anqi CMS, the custom fields of documents are a reflection of its powerful flexibility, allowing us to add various unique attributes to content, thereby enabling more precise management and display of information.But for many developers and operations personnel, how to accurately obtain the values of these custom fields through the API is often a clear issue.Don't worry, Anqi CMS provides clear paths in API design, through the `extra` field, you can easily handle these additional data.### Understand the `extra` field

2025-11-09

How to display the `extra` object, how to access its `name` and `value`?

When using AnQiCMS to manage website content, the flexibility of custom fields in the document model is one of its highlights.These custom fields allow us to add unique properties for different types of documents (such as articles, products, etc.), greatly enriching the content dimensions.When obtaining document details or lists through the API, the information of these custom fields is cleverly encapsulated in the `extra` object of the returned data.

2025-11-09

What detailed information will the nested `category` object return?

When we explore the mysteries of content in AnQi CMS, we often need to obtain detailed information about the documents.The `archiveDetail` interface provides us with rich document data, and the nested `category` object is a frequently overlooked but extremely important repository of information.It is not just a simple classification ID, but a complete entity containing all the metadata of the classification, which provides great convenience for us to deeply understand the context of the document and to carry out refined content display.

2025-11-09

If the document is a product type, how can you get its `price` (price) and `stock` (stock) information?

In Anqi CMS, if you are managing documents of product types and need to obtain specific price (`price`) and stock (`stock`) information for these products, it is actually very direct and convenient.The design of AnQi CMS considers such needs, making these key data as one of the core attributes of the document, you can easily obtain them through several core interfaces.### Get the price and stock information of a single product document When you need to view the price and stock of a specific product, AnQi CMS provides the `archiveDetail` interface

2025-11-09

Does the document detail interface directly provide the detailed content of the document's category (`category.content`)?

When using AnQi CMS for website development or content integration, it is often necessary to obtain documents and their related information.One of the common questions is: When getting the details of a document, can we also get the detailed content of the category to which the document belongs, especially fields like `category.content`?According to the documents provided by AnQi CMS, we can clearly find the answer.To be direct, **yes, the AnQi CMS document detail interface (`/api/archive/detail`) indeed provides detailed content of the document's category

2025-11-09

How to ensure the uniqueness of document URL alias queries to avoid ambiguity?

When using AnQi CMS for content management, URL aliases (also known as URL Tokens) are a key component for building user-friendly and SEO-optimized websites.It not only makes your page address more readable, but also helps search engines better understand the content topic.However, it is particularly important to ensure the uniqueness of the document when querying through these URL aliases, otherwise it may cause the system to identify confusion, users to access incorrect pages, and even affect the SEO performance of the website.

2025-11-09

Does the data structure returned by the document detail interface change for different types of documents (such as articles and products)?

When building a website with AnQiCMS, we often need to obtain detailed information of various documents through the API interface.The `archive/detail` interface is the key to obtaining the details of a single document.Many developers and content operators may be curious, whether the data structure returned by this interface is different for different types of documents, such as ordinary articles, news, or product information on e-commerce websites.The answer is: it has both unity and high flexibility.First, Anqi CMS is in design

2025-11-09

How to get the link and title of the 'previous' or 'next' document by using the `id` of the current document through other interfaces?

In content-based websites, users often want to be able to easily navigate from the current article to the previous or next article. This continuous reading experience is crucial for improving user satisfaction and the website's PV (page views).AnQiCMS (AnQiCMS) provided us with a simple and efficient API interface to implement this function, allowing developers to easily integrate "previous/next" navigation on the article detail page.### Subtly Utilize API, Build Article Navigation AnQi CMS provides a very intuitive interface for obtaining the previous and next articles

2025-11-09