introduction-to-postman-course icon indicating copy to clipboard operation
introduction-to-postman-course copied to clipboard

order api doesnt work

Open LiJell opened this issue 1 year ago • 1 comments

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."}

LiJell avatar Aug 10 '23 09:08 LiJell

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

vdespa avatar Aug 10 '23 15:08 vdespa