Interface to Check Document Existence

Check if the specified document exists in the system, verify the existence of the document through document ID, title, URL alias, or original URL, and return the basic information of the document.

Points to note

  • This interface uses the GET method, parameters are passed through the URL query string
  • You must provide a valid token parameter in the URL for authentication
  • You must provide one of the following parameters: id, title, url_token, origin_url
  • Used to check if the document exists before importing it
  • Return basic information of an existing document, including ID, title, and link

Request address

{域名地址}/api/import/archive?token={token}&id={id}

Description:{域名地址}Replace with your domain address,{token}Need to be replaced with the Token from the background content import interface, such ashttps://en.anqicms.com/api/import/archive?token=xxx

Request Syntax

GET {域名地址}/api/import/archive?token={token}&[id|title|url_token|origin_url]={value}

Request Headers

This interface involves only public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

URL parameters

Field name Type Required Description
token string Is Token in the background content import interface feature
id int No Document ID, one of id, title, url_token, origin_url must be provided
Title string No The document title, id, title, url_token, origin_url must be passed one
URL Token string No Document URL alias, one of id, title, url_token, or origin_url must be provided
origin_url string No The original document URL, one of id, title, url_token, or origin_url must be provided

Response header

This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object Return data content

data parameter

Field name Type Description
id int Document ID
Title string Document title
link string Document URL

Usage Example

Example request to query by document ID

GET /api/import/archive?token=4712a54b4c456bb29b7816d241db69a7&id=1 HTTP/1.1
Host: www.anqicms.com

Example of query request by document title

GET /api/import/archive?token=4712a54b4c456bb29b7816d241db69a7&title=欢迎使用AnqiCMS HTTP/1.1
Host: www.anqicms.com

Example of query request by URL alias

GET /api/import/archive?token=4712a54b4c456bb29b7816d241db69a7&url_token=anqicms HTTP/1.1
Host: www.anqicms.com

Example of query request by original URL

GET /api/import/archive?token=4712a54b4c456bb29b7816d241db69a7&origin_url=https://example.com/article/1 HTTP/1.1
Host: www.anqicms.com

Response example when the document exists

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 1,
    "title": "欢迎使用AnqiCMS",
    "link": "https://en.anqicms.com/anqicms"
  }
}

Response example when the document does not exist

{
  "code": -1,
  "msg": "文档不存在",
  "data": null
}

Example of error response

{
  "code": -1,
  "msg": "缺少必要参数",
  "data": null
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK