# How to invoke REST API using basic authentication?

Using cURL:

To invoke the REST API with basic authentication using cURL, simply append the --user flag followed by your username and password to the cURL command,

--user "username:password"
1

Example:

curl -X POST -T @./my-heap-dump.zip "http://localhost:8080/analyze-hd-api?apiKey={YOUR_API_KEY}" --header "Content-Type:text" --header "Content-Encoding:zip" --user "ycUser:ycPassword"
1

Using Postman:

To pass credentials and invoke the REST API with Postman, follow these steps:

  1. Open Postman.
  2. Go to the 'Authorization' tab.
  3. Select 'Basic Auth' type from the dropdown menu.
  1. You will see two textboxes on the right side of the screen.
  1. Enter your username and password that you have configured when enabling basic authentication. In the example below, we have configured 'ycrash' as both the username and password.