如何发送带有参数的POST请求?
我在OpenAPI中定义了以下POST方法:如何发送带有参数的POST请求?,post,swagger,insomnia,Post,Swagger,Insomnia,我在OpenAPI中定义了以下POST方法: post: tags: - Courses description: Creates a new Course and add it to specified Program parameters: - name: Program in: path description: Specified Program to add the new course to required: true schem
post:
tags:
- Courses
description: Creates a new Course and add it to specified Program
parameters:
- name: Program
in: path
description: Specified Program to add the new course to
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Course'
在这里,我可以定义课程
对象,我想通过body/JSON选项卡添加,但是如何定义所需的参数?它在查询选项卡中的工作方式与GET方法不同
我是否使用参数手动设置POST请求的路径,或者是否存在内置方式(或者根本不可能)
以下是尝试在“查询”选项卡中添加程序参数时的旋度:
curl --request POST \
--url 'http://localhost:8080/Courses?Program=Testprogram' \
--header 'content-type: application/json' \
--data '{
"name": "TestCourse",
"type": "UE",
"etcs": 26,
"courseID": 909090
}'