URL重定向-更新
接口信息
- 接口地址:
{your-site-url}/api/skill/redirect/update
- 基础 URL:
{your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
- 请求方式:
POST
- 说明: 此接口用于更新一条已有的重定向规则。
认证
请求头中需要携带 skill-access-token:
| Header |
值 |
skill-access-token |
{your-skill-access-token} (请替换为你自己的 token) |
Content-Type |
application/json |
请求参数 (JSON Body)
| 字段 |
类型 |
必填 |
说明 |
id |
int |
是 |
重定向记录 ID |
path |
string |
是 |
要重定向的旧路径 |
target |
string |
是 |
重定向的目标路径。可以是站内路径或外部 URL |
请求示例
cURL
curl --location --request POST '{your-site-url}/api/skill/redirect/update' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 489,
"path": "/products/xxxxx1",
"target": "/products/yyyyy2"
}'
返回结果
code 为 200 表示调用成功;code 不为 200 表示调用失败。
成功响应
{
"code": 200,
"data": {
"id": 489,
"shop_id": 15,
"path": "/products/xxxxx1",
"target": "/products/yyyyy2",
"updated_at": "2026-06-04 11:33:36",
"created_at": "2026-06-04 11:32:13",
"type": 10,
"o_id": 0
},
"message": "success"
}
返回字段说明
| 字段 |
类型 |
说明 |
code |
Number |
状态码,200 表示成功 |
message |
String |
执行结果的文字描述 |
data |
Object |
更新后的重定向完整信息 |
data 字段
| 字段 |
类型 |
说明 |
id |
int |
重定向记录 ID |
shop_id |
int |
店铺 ID |
path |
string |
旧路径 |
target |
string |
目标路径 |
type |
int |
重定向类型 |
o_id |
int |
对应实体 ID |
created_at |
string |
创建时间 |
updated_at |
string |
最后更新时间 |
注意事项
- 通过
id 指定要更新的重定向记录
- 仅可更新
path 和 target,type 和 o_id 由系统维护不可更改
- 此接口为全量更新,需传入完整的
path 和 target, 可以先通过URL重定向-详细获取信息,然后再进行全量更新