Updates a pet in the store with form data
1 min
POST
//petstore.swagger.io/v2/pet/{petId}
Path Parameters
- petIdintegerrequiredDescription
Form Parameters
- namestringDescription
- statusstringDescription
Responses
405
curl
curl --location '//petstore.swagger.io/sandbox/pet/1234' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--form 'name="bb"' \
--form 'status="bbb"'javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var formdata = new FormData();
formdata.append("name", "bb");
formdata.append("status", "bbb");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("//petstore.swagger.io/sandbox/pet/1234", 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/sandbox/pet/1234")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
form_data = [['name', File.open('undefined')],['status', File.open('undefined')]]
request.set_form form_data, 'multipart/form-data'
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/sandbox/pet/1234"
payload = {}
files=[
]
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
405
// Invalid input
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.