Import the interface and check by title first, whether the article will be written again if there are duplicates

Will batch import write a duplicate entry, it depends on the duplicate check rule of the import interface: Document content import interface /api/import/archive First use GET to pass the title, you can query whether this document already exists, both the formal document table and the draft table will be checked;Change to POST write and check the title for duplicates, by default, if the title is duplicated, it will fail and return a duplicate prompt, only by explicitly adding the overwrite parameter will it be written into the existing record;Set the parameter to continue inserting, and it will coexist with two. Therefore, the answer to the question 'Will a duplicate article be written again' is that it is not the default, unless the caller actively requests it.

What is checked for duplicate by title

Three things are checked. Besides the title, the interface also supports checking for the existence of address alias and original site address, which are more likely to expose duplicates: if the same article is imported again after changing the title, the title cannot be found, but the original site address can. Duplicate checking will cover both formal documents and drafts, and the content to be published in the scheduled release schedule is also on the draft side, so there will not be a situation where 'it is occupied but not visible in the list'.

A common misconception of the caller is to maintain a list of imported items themselves. The list may drift from the online status, especially after someone manually changes the title in the background; it is more convenient to hand over the duplicate check to the interface query request and ask once before each import than to clean up later.

Will duplicate submissions be skipped or overwritten?

There are three ways to handle this, controlled by a parameter, the default value is not to overwrite:

  • Not overwrite (default): If the title or the original site address hits an existing record, this write operation will fail and return a duplicate prompt; this is exactly the branch that can be captured by the program.
  • Cover: Write the content into the existing record after a hit, keep the document identifier unchanged, and continue following this record with historical links and statistics;
  • Continue inserting: Still create a new one after a hit, suitable for scenarios where both versions need to be kept, but for content sites usually means duplicate pages, use with caution.

The interface requires token authentication, the caller should put the token in the server configuration, do not write it into the front-end code or repository.

What are the appropriate formats for compressed packages and tables?

The batch import in the background supports two formats: ZIP compressed package and Excel spreadsheet. The compressed package is suitable for the whole site migration of text and images - the main text, images, and attachments go in together, and the progress of the task can be queried; the Excel spreadsheet is suitable for structured batch processing, columns such as categories, titles, keywords, and descriptions are arranged in columns, first clean a column and then import, which is faster than editing one by one in the editor. The two channels solve 'large quantities', the interface solves 'written continuously by the program', do not mix the same expected results from different sources.

Confirm which fields before API call

Align the field list before the call to avoid rework after import. Required or strongly related: Title, content, column (use column number or provide the column name directly; if the name does not exist, create a column by name), keywords and description, tags. Status-related: Whether to write as a draft, publish time (scheduled to a specific time will enter the pending release), alias. Content attributes: pictures and covers, templates, abstracts, reading level and price of these custom fields.

Field names are as specified in the API documentation, which is provided under the internal interface help category; high-frequency call capabilities include document list and details, categories and tags, image upload, messages and comments, friend links, system settings and contact information, usually only a few of these are used in an integration, but the scope of authority and token should be unified.

Inspection after import

Inspection should proceed according to four items. Is the title and summary in place (if the description is empty, the front-end will display a truncated正文)? Is the column attribution correct, is the classification hierarchy consistent with the old system; Is the image accessible, has the attachment path been migrated; Is the status as expected, are drafts, pending publication, and formal documents visible on the front-end? After batch import, it is recommended to randomly select a few articles, rather than just looking at the first page of the list - when imported in order, problems are often concentrated at the end.

Common questions

Will importing the same article twice result in two records?I don't know, by default, title duplication hit means failure; to override, you need to explicitly specify the override parameter, and to coexist, you should continue to insert.

What if the title is changed and the reimported content cannot be found?Check again using the original site address or alias, these two items are more stable than the title.

Can batch import and interface import be used at the same time?Yes, but it is recommended to take only one channel for the same batch of content, to avoid it being difficult to judge which one to use when both sides write at the same time.