What method should be used for batch importing articles, and what scenarios do the interface and backend manage?
How to use the batch import function for articles depends on where the content comes from and who triggers it: a batch of manuscripts manually organized go through the background batch import, and archives automatically produced by the program go through the import interface. AnQiCMS keeps both paths, supporting two types of batch import forms in the background, such as ZIP compression packages and Excel spreadsheets, and providing document content import interfaces on the interface side./api/import/archiveYou can first check the title to see if it already exists before deciding whether to write. The cost of choosing incorrectly is usually duplicate documents and misplaced fields, not import failure.
The division of labor between the two chains
Background batch import is an operation where people are present: organize the catalog, package, import, and check the results. It is manageable to process several hundred articles at once, but it is not suitable for daily incremental updates. Interface import is an operation where the program is present: the caller is responsible for preparing the data and retrying, while the site is only responsible for receiving and checking for duplicates, suitable for content factory assembly lines, cross-system synchronization, and articles driven by scripts or AI tools.
The judgment criteria are very practical: whether the same batch of content needs to be manually confirmed each time. Items that require confirmation go through the background, and items that only follow the rules go through the interface.
| Dimension | Batch import in the background | Interface import (/api/import/archive) |
|---|---|---|
| Triggerer | Manual operation by site operation personnel | Program or script call |
| Input form | ZIP compressed package, Excel table | Archived data submitted in the request body |
| Suitable frequency | One-time migration, phased supplementing | Daily increment, continuous synchronization |
| Duplicate removal method | Manual verification list before import | Check if it exists by title first |
| Failure handling | Check background prompts and reorganize package | Retry and record logs by the caller |
Applicability of background batch import
Export data from the old system, the most common product is a content compression package and a table. This type of one-time migration is most convenient to use batch import in the background: first try 5 to 10 articles in a small category, confirm that the title, publication time, category attribution, and tags match, and then expand to the whole batch. One-time migration has a large scale, and it should be confirmed before import that backups are available, make a backup of the data (including static files), so that the entire site can be rolled back in case of problems.
There are only three situations suitable for going through the background: the source data is a manually organized document package; the category mapping has not been finalized and needs to be adjusted on the go; and immediate manual inspection of layout is required after import.
What scenarios are suitable for interface import
Programmatic content creation must go through the interface. Typical scenarios include scheduling the delivery of finalized content from external editing systems daily, or by automated writing processes to batch generate content. The key action of interface import is 'search first, then write': calling/api/import/archiveFirst, check if the document exists by title, skip or update if it exists, and write if it does not exist. Without this step, the same article may be pushed out as ten or so duplicate documents within a few days, and then cleaned up one by one with the recycle bin.
The caller needs to know about the capabilities of document list and details, classification and tags, the interface documentation should be read before integration; AnQiCMS's public API covers document list/details, classification and tags, image upload, comments and reviews, friend links, system settings, and other high-frequency capabilities, go through these interface documents first and then decide where to place the import interface in the process.
Check which fields before migration.
Most of the failures in import are not 'cannot be imported', but 'imported incorrectly'. Make a list of field verification before taking action:
- Title: Whether the column name prefix of the old system is included, whether it is repeated.
- How to map old categories to new categories, or go to the default category directly if not mapped?
- Custom fields: Are the field names consistent in the content model? AnQiCMS supports custom content models and custom fields. If the names of the extended fields in the old system do not match, they will be empty after import, and this part needs to be synchronized in the template.
- Text and images: Is the image accessible on the new site, and should external links be saved first?
- Status: Whether the imported draft, to be published, or formal document should be scheduled for release.
How to inspect after migration?
The sampling ratio is more effective when viewed in full. Check a few articles per category, ensure that the title, content layout, images, tags, and abstracts are complete, and then confirm that the list page and detail page can be opened normally. Place the continuation of old links in this step: either use 301 redirect from the old address to the new address, or use the site-wide replacement tool to batch replace keywords or links, so that the completion of import does not equal the completion of going online.
Don't panic if you delete the wrong document: deleting formal documents is to move them to the recycle bin instead of physical deletion, and they can be restored from the recycle bin, which leaves room for cleaning after batch import.
Common questions
The old system can only export HTML files, which path to take?Create a ZIP compressed package for batch import via background; keep the directory structure of the package one level, avoiding overlapping of files with the same name.
Can interface import and background batch import be used together?Yes. The common practice is to use background batch import for historical content, and hand over the incremental updates to the interface on a daily basis.
What should you do if the category is incorrectly assigned after import?For small batches, make changes one by one in the background. For batch errors, first use the site-wide replacement to process links and keywords, then adjust batch by category, and make a backup before making changes.
How should you handle the same batch of content being imported twice?Retain one copy based on the title, delete the rest into the recycle bin, and clear it after confirming it is correct; next time, prevent duplicate entries by querying the title from the interface side.