**版本：202201**

# 创建 URL 重定向

**POST** `/openapi/2022-01/redirects`

使用提供的详情创建新的 URL 重定向规则。

## 请求

**application/json**

**请求体 | 示例**

**请求体**

- `from_url` string (required)

  Original URL, for example: `/collections/hot-selling`
- `redirect_url` string (required)

  Redirected URL, for example: `/collections/test1567`
- `status` string (required)

  The status of the redirect:
  - `open`: available
  - `close`: unavailable

  **默认值：** `open`

```json
{
  "from_url": "string",
  "redirect_url": "string",
  "status": "open"
}
```

## 响应

**200 | 422**

200

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `id` integer

  **默认值：** `0`

  **示例：** `373043233132924740`
- `store_id` integer

  **默认值：** `0`

  **示例：** `633130`
- `status` string

  **示例：** `open`
- `from_url` string

  **示例：** `/collections/hot-selling`
- `redirect_url` string

  **示例：** `/collections/test1567`

```json
{
  "id": 373043233132924740,
  "store_id": 633130,
  "status": "open",
  "from_url": "/collections/hot-selling",
  "redirect_url": "/collections/test1567"
}
```

```json
{
  "id": 373043233132924740,
  "store_id": 633130,
  "status": "open",
  "from_url": "/collections/hot-selling",
  "redirect_url": "/collections/test1567"
}
```

422

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `errors` string[]

```json
{
  "errors": [
    "Path has already been take"
  ]
}
```

```json
{
  "errors": [
    "Path has already been take"
  ]
}
```
