Home > Blockchain >  error testing API POST via Postman and Curl
error testing API POST via Postman and Curl

Time:12-10

enter image description here I am getting the following error when trying to test the API POST via Postman. Please can someone guide me the right way to setup an API call?

CodePudding user response:

You needs to encode to Base64 format the API Key and API secret part. it help to little bit of protection instead direct text.

Base64 (API Key : API Secret)

Example:

API Key: bHRpY3VsdHwuY29tcH

API Secret: pQaE-ceDi3nFz

encode base 64(bHRpY3VsdHwuY29tcH:pQaE-ceDi3nFz) -> YkhScFkzVnNkSHd1WTI5dGNIOnBRYUUtY2VEaTNuRno=

don't miss : between API Key and API Secret you can test in terminal

echo -n bHRpY3VsdHwuY29tcH:pQaE-ceDi3nFz | base64

enter image description here

Or enter image description here

So you can follow this step

In Postman,

#0 Enter your API URL with POST method

#1 Select Authorization tab

#2 Select Basic Auth in drop box

#3 Enter you API Key into username

#4 Enter you API Secret into password

Postman will encode automatically with base64 format If you click Headers tab, can see it.

enter image description here

enter image description here

In curl,

if you click </> icon in Postman (at right top area),it will shows curl command. you can copy it and pasted at terminal then run it,

enter image description here

enter image description here

curl --location --request POST 'https://your-api-url' \
--header 'Authorization: Basic YkhScFkzVnNkSHd1WTI5dGNIOnBRYUUtY2VEaTNuRno='

CodePudding user response:

I have checked your API and read the authentication documentation. You need the Username and API Key for authentication. Screenshot of Documentation

  • Related