Enabling the SSO redirection only applies to logins using a web browser (see How SAMLSingleSignOn works).
This mechanism can not work when only using the REST API since the login page is never visited.
So it is not possible to log in with your SSO credentials (your username/password on the Identity Provider) on the API via basic authentication.
However, it is still possible to use the REST API with SAML SSO enabled.
It is hard to say exactly which way is the best for your use case, but these are your options:
Option 1: Use OAuth (recommended)
As documented in https://developer.atlassian.com/jiradev/jira-apis/about-the-jira-rest-apis#AbouttheJIRARESTAPIs-Authenticationandauthorization , you should be able to use OAuth for your REST API scripts. This can be useful for allowing regular users to use the REST API, but requires a bigger setup work on both the admin's part and the user's part before running the script (for the first time). Atlassian has a very comprehensive tutorial here: https://developer.atlassian.com/jiradev/jira-platform/jira-architecture/security-overview/oauth
Option 2: Use HTTP basic authentication
Our SAML SSO app does not prevent users from setting their own password in the user management system. That means that using REST calls with HTTP Basic authentication and their username and password will still work. This option has the downside of basically circumventing SAML SSO at this level, but if you only need credentials for a script run with admin privileges, then this might be okay for you. Atlassian puts it like this: