Manually trigger the system to regenerate the site map (Sitemap), supporting synchronous and asynchronous processing methods, used to update search engine indexes.
Points to note
- This interface uses the POST method to submit data in form-data format
- An effective background import interface Token is required 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
- The task is completed immediately, and the background continues to execute the generation task
Request address
{域名地址}/api/import/sitemap?token={token}
Description:{域名地址}Replace with your domain address,{token}Replace with the Token in the background content import interface function, such ashttps://en.anqicms.com/api/import/sitemap?token=xxx
Request Syntax
POST {域名地址}/api/import/sitemap?token={token}
Content-Type: multipart/form-data
Request parameters
GET parameters
| Field name | Type | Required | Description |
|---|---|---|---|
| token | string | Is | 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 | int | Error code |
| msg | string | Error description |
| data | object | result content |
Usage Example
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
Synchronous mode successful response:
{
"code": 0,
"msg": "Sitemap更新完成"
}
Asynchronous mode successful response:
{
"code": 0,
"msg": "已提交后台处理,请稍后查看结果"
}
Example of error response
{
"code": -1,
"msg": "Token验证失败"
}
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 |