Delete user
1 min
DELETE
//petstore.swagger.io/v2/user/{username}
Path Parameters
- usernamestringrequiredDescription
Responses
400
404
curl
curl --request DELETE \
--url //petstore.swagger.io/v2/user/{username} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("//petstore.swagger.io/v2/user/{username}", 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("//petstore.swagger.io/v2/user/{username}")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Delete.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/v2/user/{username}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
400
// Invalid username supplied
404
// User not found
This can only be done by the logged in user.