14
とポストJSONボディ私はこのように、闊歩してJSON本体をPOSTしたいと思います:闊歩
curl -H "Content-Type: application/json" -X POST -d {"username":"foobar","password":"xxxxxxxxxxxxxxxxx", "email": "[email protected]"}' http://localhost/user/register
現在、私は、この定義があります。
"/auth/register": {
"post": {
"tags": [
"auth"
],
"summary": "Create a new user account",
"parameters": [
{
"name": "username",
"in": "query",
"description": "The username of the user",
"required": true,
"type": "string"
},
{
"name": "password",
"in": "query",
"description": "The password of the user",
"required": true,
"type": "string",
"format": "password"
},
{
"name": "email",
"in": "query",
"description": "The email of the user",
"required": true,
"type": "string",
"format": "email"
}
],
"responses": {
"201": {
"description": "The user account has been created",
"schema": {
"$ref": "#/definitions/User"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Errors"
}
}
}
}
}
をしかし、データがに送信されますURL。ここで生成されたカール闊歩提供:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 'http://localhost/user/register?username=foobar&password=password&email=foo%40bar.com'
私はquery
keyworkが良くないことを理解し、私はJSON本体を投稿する方法を見つけることができませんでした。私はformData
を試しましたが、動作しませんでした。あなたはbody
パラメータを使用する必要があります
それは完璧です、ありがとう! – ncrocfer
laravel-5.5でモデルを作成するには? –