Manually Update Sitemap Interface

Manually trigger the system to regenerate the site map (Sitemap), supporting both synchronous and asynchronous processing methods for updating search engine indexes.

Precautions

  • This interface uses the POST method to submit data in form-data format
  • Need to provide a valid backend import interface Token for authentication
  • Supports synchronous and asynchronous processing modes, asynchronous mode is suitable for sites with a large amount of content
  • Synchronous mode will wait for the Sitemap to be generated before returning the result
  • Process the result immediately in asynchronous mode, the background continues to execute the generation task

Request address

{域名地址}/api/import/sitemap?token={token}

Description:{域名地址}It needs to be replaced with your domain address.{token}The Token needs to be replaced with the one in the background content import interface function:https://en.anqicms.com/api/import/sitemap?token=xxx

Request syntax

POST {域名地址}/api/import/sitemap?token={token}
Content-Type: multipart/form-data

Request Parameters

GET Parameter

Field Name Type Required Description
token string Yes Token in the background content import interface function

POST parameters

Field Name Type Required Description
async string No Whether to process asynchronously, leave blank for synchronous, 1 = asynchronous

Return parameters

Field Name Type Description
code integer Error code
message string Error Description
data object Result Content

Example Usage

Request Example

POST /api/import/sitemap?token=4712a54b4c456bb29b7816d241db69a7 HTTP/1.1
Host: www.anqicms.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="async"

1
------WebKitFormBoundary7MA4YWxkTrZu0gW--

or use the curl command (asynchronous mode):

curl -X POST \
  'https://en.anqicms.com/api/import/sitemap?token=4712a54b4c456bb29b7816d241db69a7' \
  -H 'Content-Type: multipart/form-data' \
  -F 'async=1'

or use the curl command (synchronous mode):

curl -X POST \
  'https://en.anqicms.com/api/import/sitemap?token=4712a54b4c456bb29b7816d241db69a7' \
  -H 'Content-Type: multipart/form-data'

Response Example

Successful response in synchronous mode:

{
  "code": 0,
  "msg": "Sitemap更新完成"
}

Successful response in asynchronous mode:

{
  "code": 0,
  "msg": "已提交后台处理,请稍后查看结果"
}

Error response example

{
  "code": -1,
  "msg": "Token验证失败"
}

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