würde Ich mag mit Swagger einen json Körper senden, wie folgt aus:verfassen json Körper mit Prahlerei
curl -H "Content-Type: application/json" -X POST -d {"username":"foobar","password":"xxxxxxxxxxxxxxxxx", "email": "[email protected]"}' http://localhost/user/register
Derzeit habe ich diese Definition:
"/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"
}
}
}
}
}
Aber die Daten gesendet werden in die URL Hier erzeugt die Rotation von Swagger zur Verfügung gestellt:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 'http://localhost/user/register?username=foobar&password=password&email=foo%40bar.com'
Ich verstehe, dass die query
keywork ist nicht gut, aber ich habe nicht den Weg finden einen JSON Körper zu veröffentlichen. Ich habe versucht formData
, aber es hat nicht funktioniert.
Es ist perfekt, danke! – ncrocfer
Wie erstellt man ein Modell in Laravel-5.5? –