Postman generated code runs but doesn't have all header

2 followers Follow
Avatar
Nathan Waterman

Hi,

From reading the documentation on request headers I should be including:

Content-Type: application/json
X-HTTP-Method-Override: GET

 

But this throws errors. When I use the code generated by Postman, which was successful in logging in, it doesn't use those headers. In fact, when I include those in my Postman headers, I get a 520 "Illegal request" error. Running code included below. I'm a bit confused about what is happening. Can anyone explain? Thanks

Nathan

 

options1 = {

method: "GET",

url: "https://zd7vr.kintone.com/k/v1/records.json",

qs: {

app: "1"

},

headers: {

"X-Cybozu-API-token":removed for security

}

}

request.get(options1, (err, res, body) => {

console.log(body);

})
0

2 comments

Avatar
Junko Werner 0 votes
Hi Nathan,
In Postman, the body information must be given to the request URL for GET request.
※The body information is required in the body except for GET request.
Therefore, Content-type: application/JSON is not required when you request GET.
 
In your case, you might want to remove the content-type from the header and specify the request URL like "https://zd7vr.kintone.com/k/v1/records.json?app=1"
Thanks.
Junko

 

0
Avatar
Nathan Waterman 0 votes

Junko,

Thanks for your response. To clarify, I would only need to include the content type header when using Postman?

0

Please sign in to leave a comment.