I am experimenting with API testing but I am stuck almost at the beginning. Please tell me maybe I am doing something wrong?
On the petstore3.swagger.io web-page I press Authorize button and enter the value for the api_key.
In Fiddler - Composer I choose POST method and https://petstore3.swagger.io/api/v3/pet address.
In Header I set api_key value equal to the one I entered in step 1.
In Body I copy-paste JSON from the example at petstore3.swagger.io
My request in a raw form looks ok:
POST https://petstore3.swagger.io/api/v3/pet HTTP/1.1
User-Agent:Fiddler Everywhere
Host:petstore3.swagger.io
Content-Length:215
api_key:20202020
{
"id": 11,
"name": "doggie2",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
but when I execute it I get the 400 Bad Request error:
HTTP/1.1 400 Bad Request
Date: Mon, 07 Sep 2020 21:01:37 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type, api_key, Authorization
Access-Control-Expose-Headers: Content-Disposition
Server: Jetty(9.4.9.v20180320)
content-type: application/json? – Michael Durrant Sep 07 '20 at 21:37{ "code": 400, "message": "Input error: The input body..." }. That could also help you. But it seems it's really the missing header Content-Type in this case. – pavelsaman Sep 08 '20 at 07:44accept --> application/xmlin the header. The response I am getting is in xml format and also the curl command generated swagger has the same. – Kshetra Mohan Prusty Sep 13 '20 at 14:06