$ curl https://api.blockscore.com/question_sets/536c1532627463780b000000/score \
-u sk_test_n5049aa6053c9a0217bea78070fbf501: \
--header "Accept: application/vnd.blockscore+json;version=4" \
-d 'answers[][question_id]=1' \
-d 'answers[][answer_id]=3' \
-d 'answers[][question_id]=2' \
-d 'answers[][answer_id]=2' \
-d 'answers[][question_id]=3' \
-d 'answers[][answer_id]=2' \
-d 'answers[][question_id]=4' \
-d 'answers[][answer_id]=2' \
-d 'answers[][question_id]=5' \
-d 'answers[][answer_id]=5'
how to set this parameters in getpostman?
what is equivalent of -u
, --header
, -d
?
The default
Content-Type
in cURL isapplication/x-www-form-urlencoded
. In Postman, you can just select the x-www-form-urlencoded button and start typing in your key value pairs, i.e.For
--header
, there's a Headers button at the top right. When you click it, you will see fields to type in header value pairs also. Just typeAccept
on the left, and the type value on the right.The default authentication is Basic for cURL. When you do
-u username
, you get prompted for the password. This is to protect against any shell storage of the password. You could alternatively use-u username:password
, but this will store the password in the shell history, and is not recommended. Either way, cURL will set theAuthorization
header toBasic base64encode(username:password)
.You need to actually base64 encode
username:password
. There are online places you can do so, like here. For example if you type inusername:password
then encode it, it will returndXNlcm5hbWU6cGFzc3dvcmQ=
So basically, in Postman, you should set a header
Authorization
as the name, thenBasic dXNlcm5hbWU6cGFzc3dvcmQ=
(that is if the username isusername
and the password ispassword
). Yours will be different of course.