vdespa / introduction-to-postman-course

956 stars 597 forks source link

order api doesnt work #18

Open LiJell opened 1 year ago

LiJell commented 1 year ago

Hello, thank you for your helpful video clip on youtube. I have been following your video clip and I faced issue with orders api. even if I set JSON properly, I got an error like following block.

{
    "error": "Invalid or missing bookId."
}

I input Body as below

{
    "bookId": 1,
    "customerName": "John"
}
POST /orders HTTP/1.1
Authorization: Bearer f213b3e0e68f956690e3f0b712ca559794d6251821bf965f58afd670023d7ddf
User-Agent: PostmanRuntime/7.32.3
Accept: */*
Cache-Control: no-cache
Postman-Token: 97d16743-634e-441b-b336-c62df81cffd6
Host: simple-books-api.glitch.me
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

{
"bookId": 1,
"customerName": "Minnie Kling"
}

HTTP/1.1 400 Bad Request
Date: Thu, 10 Aug 2023 09:27:10 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 38
Connection: keep-alive
x-powered-by: Express
etag: W/"26-nuV6aQ2H3vYGMuVoIahu/HIFYAI"

{"error":"Invalid or missing bookId."}
vdespa commented 1 year ago

It looks like you did not select JSON when building this request in Postman. The Content-Type header is missing.