Inorder for it to work you need to check the authentication method and verify your API based URL, here's the code for the same , execute it in your terminal.
Public Jira Cloud instances use https://yourdomain.atlassian.net/rest/api/2/