C
C#•2y ago
joy

Send http request using postman

hi all, if we have a Form data like this body: {"permissions":["see","see_contents"],"include_sub_types":[]} how can we add them in the postman?
No description
19 Replies
alkasel#159
alkasel#159•2y ago
So you have a form such that, when you submit the form itself, a string like
body: {"permissions":["see","see_contents"],"include_sub_types":[]}
body: {"permissions":["see","see_contents"],"include_sub_types":[]}
is included in the payload of the http request? In that's the case, you just need to include the body of the request in POSTMAN body > raw field. You can select JSON in order to have JSON highlighting
joy
joy•2y ago
yes.. if i select json it'll be like this.. which i dont think is correct based on the highlighting😅
No description
alkasel#159
alkasel#159•2y ago
yep, that's clearly not valid JSON You know more or less how does JSON syntax works?
{"permissions":["see","see_contents"],"include_sub_types":[]}
{"permissions":["see","see_contents"],"include_sub_types":[]}
^ THIS is valid JSON syntax Try pasting it in here
alkasel#159
alkasel#159•2y ago
The JSON Validator
JSONLint is the free online validator and reformatter tool for JSON, a lightweight data-interchange format.
joy
joy•2y ago
hmm i see, so ive to just paste this without encode the url, i wonder why this request is not working when i try to send it through postman, but it works if i access it through the website directly, have you faced this issue before? it return me something like
<TITLE>...Server Client Error</TITLE>
<H1>Error parsing the GET/POST data stream.</H1><br>Please try again. If the problem persists, contact your ... Server administrator.
<TITLE>...Server Client Error</TITLE>
<H1>Error parsing the GET/POST data stream.</H1><br>Please try again. If the problem persists, contact your ... Server administrator.
alkasel#159
alkasel#159•2y ago
I suggest using the browser developer tools in order to see the precise request the website is performing And see if it is any different from the request you perform by means of postman
joy
joy•2y ago
do you mean to copy the web request like this, is that right?
No description
joy
joy•2y ago
for example copy as fetch?
alkasel#159
alkasel#159•2y ago
Note sure what you're looking at, but e.g. if I browser at google while I have the developers tool open in the "network" tab I can see this
alkasel#159
alkasel#159•2y ago
No description
alkasel#159
alkasel#159•2y ago
As you can see, on the right I have all the requests my browser Firefox is performing towards google server and, for each request, I can check header, payload, response etc...
joy
joy•2y ago
@alkasel yes i got that info from Network tab as well, but what can we compare?
alkasel#159
alkasel#159•2y ago
you should compare the body of the request performed by the browser with the body of the request you sent by means of POSTMAN. If I understand correctly, that's the problem In the screen I posted, on the most right part you have "[[1, null...". That's the body of the request
joy
joy•2y ago
you mean the payload right haha, yeah that's what i send the first time i was asking the question..
joy
joy•2y ago
i sent this at my first statement
No description
joy
joy•2y ago
but i dont think there's much information in this, this is the payload that i paste into POSTMAN request
alkasel#159
alkasel#159•2y ago
Ah yep now I see I don't know then, I don't have the complete context neither. Maybe there is a different header... I don't know I tried to help because I know POSTMAN, but this may be out of my scope Make sure you have set the http verb in POSTMAN correctly (e.g. POST instead of GET)
joy
joy•2y ago
yeah i set that to be the same as the browser request.. im not sure what could be the issue i think i'll try to check further first @alkasel thank you so much for your help!
alkasel#159
alkasel#159•2y ago
No problem 🙂