Check if Document Exists Interface

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

Precautions

  • This interface uses the GET method, parameters are passed through the URL query string
  • The token parameter must be provided in the URL for authentication
  • Must provide any one of the parameters id, title, url_token, or origin_url
  • Used to check if the document already exists before importing
  • Return basic information of the existing document, including ID, title, and link

Request address

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

Description:{域名地址}It needs to be replaced with your domain address.{token}It needs to be replaced with the Token from the backend content import interface feature.https://en.anqicms.com/api/import/archive?token=xxx

Request syntax

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

Request header

This interface only involves 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 Yes Token in the background content import interface function
id integer No Document ID, one of id, title, url_token, or origin_url must be provided
Title string No Document title, one of id, title, url_token, origin_url must be provided
url_token string No Document URL alias, one of id, title, url_token, 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 Headers

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

Return parameters

Field Name Type Description
code integer Error code
message string Error Description
data object Return data content

data Parameter

Field Name Type Description
id integer Document ID
Title string Document Title
link string Document URL

Example Usage

Request example by document ID

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

Query Request Example by Document Title

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

Query Request Example by URL Alias

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

Query Request Example 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 Document Exists

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

Response Example when Document Does Not Exist

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

Error response example

{
  "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 Unauthorized
200 API request OK