Create user.
POST
/user
curl -X POST 'https://petstore3.swagger.io/api/v3/user' \ -H 'Content-Type: application/json' \ -d '{"email":"john@email.com","firstName":"John","id":10,"lastName":"James","password":"12345","phone":"12345","userStatus":1,"username":"theUser"}'package main
import ( "context" "net/http" "strings")
func main() { ctx := context.Background() body := strings.NewReader(`{"email":"john@email.com","firstName":"John","id":10,"lastName":"James","password":"12345","phone":"12345","userStatus":1,"username":"theUser"}`) req, err := http.NewRequestWithContext(ctx, "POST", "https://petstore3.swagger.io/api/v3/user", body) if err != nil { panic(err) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close()}import requests
response = requests.request( "POST", "https://petstore3.swagger.io/api/v3/user", headers={"Content-Type": "application/json"}, data='{"email":"john@email.com","firstName":"John","id":10,"lastName":"James","password":"12345","phone":"12345","userStatus":1,"username":"theUser"}',)print(response.json())const response = await fetch('https://petstore3.swagger.io/api/v3/user', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({"email":"john@email.com","firstName":"John","id":10,"lastName":"James","password":"12345","phone":"12345","userStatus":1,"username":"theUser"}),});const data = await response.json();This can only be done by the logged in user.
Request Body
Section titled “Request Body ”Created user object
object
email
string
Example
john@email.com firstName
string
Example
John id
integer format: int64
Example
10 lastName
string
Example
James password
string
Example
12345 phone
string
Example
12345 userStatus
User Status
integer format: int32
Example
1 username
string
Example
theUserobject
email
string
Example
john@email.com firstName
string
Example
John id
integer format: int64
Example
10 lastName
string
Example
James password
string
Example
12345 phone
string
Example
12345 userStatus
User Status
integer format: int32
Example
1 username
string
Example
theUserobject
email
string
Example
john@email.com firstName
string
Example
John id
integer format: int64
Example
10 lastName
string
Example
James password
string
Example
12345 phone
string
Example
12345 userStatus
User Status
integer format: int32
Example
1 username
string
Example
theUserResponses
Section titled “ Responses ”Successful operation
object
email
string
firstName
string
id
integer format: int64
lastName
string
password
string
phone
string
userStatus
User Status
integer format: int32
username
string
Example
{ "email": "john@email.com", "firstName": "John", "id": 10, "lastName": "James", "password": "12345", "phone": "12345", "userStatus": 1, "username": "theUser"}object
email
string
Example
john@email.com firstName
string
Example
John id
integer format: int64
Example
10 lastName
string
Example
James password
string
Example
12345 phone
string
Example
12345 userStatus
User Status
integer format: int32
Example
1 username
string
Example
theUserdefault
Section titled “default ”Unexpected error