> For the complete documentation index, see [llms.txt](https://support.iafcertsearch.org/api-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.iafcertsearch.org/api-developer-guide/api-zh/api-integration/requests.md).

# 请求

### 发起请求

#### 主机

Web API v1 请求的主机始终为 `https://api.iafcertsearch.org/api/client/v1`

{% hint style="info" %}
所有请求必须使用 HTTPS。API 不支持 HTTP。
{% endhint %}

#### 授权头

您必须提供一个如 [Authentication](https://github.com/QualityTrade/iaf-docs-api-developer-guide-cn/blob/main/api-integration/broken-reference/README.md) 中所述的授权头。

#### HTTP 动词

* `GET` 检索资源或一组资源
* `POST` 创建新资源
* `PUT` 更新现有资源
* `DELETE` 删除现有资源
* `OPTIONS` 查看针对特定资源的允许动词

#### 接受头

API 提供 JSON 响应。目前不需要接受头，但将来可能需要。如果未设置，API 将使用 `application/json`。

```http
GET https://api.iafcertsearch.org/api/client/v1/endpoint HTTP/1.1
Accept: application/json
```

#### 数据数组

当您在 `GET` 请求中发送一个数据数组时，您需要在 URL 上多次包含该参数。参数名称不需要括号。

```http
GET https://api.iafcertsearch.org/api/client/v1/endpoint?parameter=data1&parameter=data2 HTTP/1.1
```

### 格式化请求

#### 请求主体

通过 `POST` 或 `PUT` 向资源提交数据时，必须使用 JSON 提交有效负载。

```http
POST https://api.iafcertsearch.org/api/client/v1/example/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "name": "new example name"
}
```

#### 分页

某些 `GET` 资源允许以批处理的方式检索信息。适用时，我们将在资源文档中提供查询参数。

当请求多个项目时，我们将默认请求限制为 `20` 个项目。您可以使用 `limit` 参数指定不同的限制。我们接受 `limit` 参数的最大值为 `100`。

下面是一个API请求的示例，该示例根据 `limit=100` 和 `offset=0` 参数检索了前 `100` 条记录。

要检索下一批记录，请将偏移参数增加 `1`。

```http
GET https://api.iafcertsearch.org/api/client/v1/resource?limit=100&offset=0 HTTP/1.1
```

### 成功的请求

| **动词** | **返回的资源对象**     |
| ------ | --------------- |
| GET    | 返回单个资源对象或一组资源对象 |
| PATCH  | 返回更新后的资源对象      |
| PUT    | 返回更新后的资源对象      |
| DELETE | 不返回任何内容         |
| POST   | 返回新创建的资源对象      |
