When using the Safe CMS for website content management and development, we often obtain various data through API interfaces, including retrieving document details (/api/archive/detailIt is very commonly used.When you call this interface, if you encounter system error codes 1001 or 1002, it usually indicates that the request was not successfully processed and a specific reason was given.Understanding the meanings and solutions of these error codes can help us efficiently troubleshoot problems and ensure the normal display of website content.

Error code 1001: Not logged in

Common cause analysis:

  1. Not logged in:You may not have performed user login operations, or the user's login status has expired on the front-end page/client application.
  2. Session expired:The user has logged in before, but due to a long period of inactivity or other security policies, the login session (such as stored Tokens) has expired and needs to be refreshed.
  3. Content is restricted:You are trying to access a document detail that is set to 'Visible to logged-in users only', but your current request does not carry valid login credentials.

Solution: The most direct solution is to perform user login. The安企CMS provides a login interface (usually/api/login),Through this interface, after successful login, the system will return a user credential (usually a Token). You need to ensure that this Token is correctly attached to the request header in subsequent API requests (for example,AuthorizationField) or as a request parameter.For front-end applications, this means you need to implement the login process and properly store the obtained Token (such as LocalStorage or Cookie) after the user logs in, so that it can be carried with each request to an authenticated interface.If the Token expires, the user needs to be prompted to re-login to obtain a new Token.

Error code 1002: Unauthorized

Different from 1001, error code 1002 means that although you have logged in and the system has recognized 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 ordinary 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 by specific user groups or permission levels (such as VIP content, paid content, internal materials, etc.).
  2. User group permission insufficient:The user group (such as general member group) to which the account you are currently logged in belongs has not been granted permission to access 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 paid content, you may need to complete the payment first before you can view the details.

Solution: Fixing error 1002 requires addressing the permissions level:

  • Confirm document permissions:In the Anqi CMS background management interface, find the document you are trying to access, check its 'reading level', 'access permission', or related settings, and confirm whether the document is open to all users or only to specific user groups.
  • Verify user group:
  • Contact administrator:If none of the above checks resolve the issue or you are unsure 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 the necessary adjustments.
  • Check payment status:If the document is a paid content, it needs toarchiveOrderCheckconfirm through the API whether the payment has been made.

General Troubleshooting Suggestions

Whether it's 1001 or 1002, when you encounter these errors, the following general troubleshooting steps may be helpful:

  • Carefully check the API request parameters: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, which may indirectly lead to other errors.
  • View the complete API return information:The Anqi CMS usually returns error codes when,msgProvide more detailed error descriptions in the field, which helps you locate problems faster. For example, prompts such as "not logged in" or "insufficient permissions" will appear directly.msgfield in.
  • Check network and server status:Ensure that your network connection is normal and that the 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 AQ CMS and the backend management features, you can efficiently resolve these issues and ensure smooth access to the website content.


Common Questions (FAQ)

Q1: If the document detail interface does not return an error code,datawhat 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 file name you 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 does everything work fine in my local testing, but I encounter 1001/1002 errors after deploying to the server?

Q3: Is there any other way to manage user access to documents besides manually modifying permissions?