Create user
1 min
POST
https://petstore3.swagger.io/api/v3/user
Body Parameters
- bodyUserDescription
- idinteger<int64>Example
- usernamestringExample
- firstNamestringExample
- lastNamestringExample
- emailstringExample
- passwordstringExample
- phonestringExample
- userStatusinteger<int32>ExampleDescription
Form Parameters
- idinteger<int64>Example
- usernamestringExample
- firstNamestringExample
- lastNamestringExample
- emailstringExample
- passwordstringExample
- phonestringExample
- userStatusinteger<int32>ExampleDescription
Responses
default
- User
- idinteger<int64>Example
- usernamestringExample
- firstNamestringExample
- lastNamestringExample
- emailstringExample
- passwordstringExample
- phonestringExample
- userStatusinteger<int32>ExampleDescription
curl
curl --location 'https://petstore3.swagger.io/api/v3/user' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"id": 0,
"username": "",
"firstName": "",
"lastName": "",
"email": "",
"password": "",
"phone": "",
"userStatus": 0
}'javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"id": 0,
"username": "",
"firstName": "",
"lastName": "",
"email": "",
"password": "",
"phone": "",
"userStatus": 0
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://petstore3.swagger.io/api/v3/user", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://petstore3.swagger.io/api/v3/user")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"id": 0,
"username": "",
"firstName": "",
"lastName": "",
"email": "",
"password": "",
"phone": "",
"userStatus": 0
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://petstore3.swagger.io/api/v3/user"
payload = json.dumps({
"id": 0,
"username": "",
"firstName": "",
"lastName": "",
"email": "",
"password": "",
"phone": "",
"userStatus": 0
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
default
// successful operation
{
"id": 10,
"username": "theUser",
"firstName": "John",
"lastName": "James",
"email": "[email protected]",
"password": "12345",
"phone": "12345",
"userStatus": 1
}This can only be done by the logged in user.
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.