> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiIyNDZmM2NlZS00MjVhLTRmODAtOTc1Yy03NTUyYTczYjYyN2QiLCJleHAiOjE3Nzg0OTMwNjEsImlhdCI6MTc3ODQ5Mjc2MX0.ODd_mWInkEjsukrA7GMFww7svj0nkAtHVYkhA43ooh8
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# HTTP JSON 端点

OpenAPI 中的端点定义在 `paths` 键下。以下是定义单个端点的示例：

```yml title="openapi.yml" maxLines=0 {2-18}
paths:
  /pets:
    post:
      summary: Create a new pet
      description: Creates a new pet with the provided information
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
      responses:
        '200':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
```

## 示例

您可以通过使用 `examples` 键来提供请求和响应的示例。

```yaml title="openapi.yml" {12-17,25-30}
paths:
  /pets:
    post:
      summary: Create a new pet
      description: Creates a new pet with the provided information
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
            examples:
              PetExample:
                summary: This is an example of a Pet
                value: 
                  name: Markley
                  id: 44
      responses:
        '200':
          description: A Pet object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
              examples:
                PetExample:
                  summary: This is an example of a Pet
                  value: 
                    name: Markley
                    id: 44
```