0

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?

Deepam
  • 19
  • 3
  • No! You cannot post images of the code. To test you code I need to be able to copy it and test. I am NOT going to retype your code. – Misunderstood Dec 10 '22 at 07:19

1 Answers1

0

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)

Authorization: Basic Base64 result

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 this site

https://www.base64encode.org/

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='
Bench Vue
  • 5,257
  • 2
  • 10
  • 14
  • Thank you so so much for taking this much effort to help...I was able to follow your guidance and used the following Curl command - but now I am getting "insufficient credit message" which probably means that I need to buy more credits but the website does not offer any way to add more credits...I will try to contact them. thanks again so much. – Deepam Dec 10 '22 at 21:06
  • You are welcome, If you success testing, give me a thumbs up in my answer. – Bench Vue Dec 10 '22 at 22:24