首页 > 解决方案 > Open API 3.0 如何添加 API 正文元素?

问题描述

我正在尝试为会后电话会议创建一个招摇的文档。我不确定如何在参数下添加正文字段(如 meeting.name、meeting.time、meeting.duration 等)。我在参数“allowedValues:路径、查询、标题、cookie”中得到错误。我不确定从这里选择哪一个?我之前通过编写“-in:body”来完成此操作,但 body 在这里似乎不是一个选项。

 openapi: '3.0.0'
info:
  title: WebcastCreateMeeting
  version: "1.1"
servers:
  - url: https://api.webcasts.com/api
paths:
  '/event/create/{event_title}/{folder_id}/{type}/{scheduled_start_time}/{scheduled_duration}/{timezone}/{region}/{acquisition_type}/{audience_capacity}/{event_expiration_months}/{token}':
    post:
      tags:
       - CreateMeetingCallbody
      summary: EventGM
      parameters:  
        - in: path
          name: token
          description: the auth token
          required: true
          schema:
            type: string
            example: 123j1lkj3lk1j3i1j23l1kj3k1j2l3j12l3j1l2
        - in: path
          name: event_title
          description: Name of the event from Cvent
          required: true
          schema:
            type: string
        - in: body
          name: user
          description: this is a test user
          schema:
            type: object
            required: 
              - username
            properties:
              username:
               type: string
        - in: path
          name: folder_id
          description: ID of the folder under whihc the Meeting is to be added
          required: true
          schema:
            type: string
        - in: path
          name: type
          description: Type of the Meeting
          required: true
          schema:
            type: string
        - in: path
          name: scheduled_start_time
          description: Start time of
          required: true
          schema:
            type: string
            format: date-time
        - in: path
          name: scheduled_duration
          description: Duration
          required: true
          schema:
            type: integer
            example: 60
        - in: path
          name: timezone
          description: TimeZone of the event LU table
          required: true
          schema:
            type: string
        - in: path
          name: region
          description: Region from Zoom
          required: true
          schema:
            type: integer
            example: 1
        - in: path
          name: acquisition_type
          description: To be added from GM
          required: true
          schema:
            type: integer
            example: 0
        - in: path
          name: audience_capacity
          description: To be added for capacity
          required: true
          schema:
            type: integer
        - in: path
          name: event_expiration_months
          description: the month it expires on.
          required: true
          schema:
            type: integer
            example: 3
      responses:
        200:
          description: This would be the response.
          content:
            application/json;charset=utf-8:
              schema:
                type: array
                items:
                  properties:
                    scheduled_duration:
                      type: integer
                      example: 30
                    event_id:
                      type: integer
                      example: 0000000
                    audience_capacity:
                     type: integer
                     example: 30
                    folder_name:
                      type: string
                      example: Folder_Name
                    viewer_link:
                      type: string
                      example: https://viewer_link
                    scheduled_start_time:
                     type: string
                     format: date-time
                     example: 1541674800000
                    scheduled_player_close_time:
                     type: integer
                     example: 10
                    event_title:
                      type: string
                    
  [![enter image description here][1]][1]

请就如何描述我应该在代码中传递的正文字段提出建议。

谢谢

标签: openapiswagger-editor

解决方案


知道了,它在“requestbody”中单独通过,检查here

谢谢。


推荐阅读