how to create a button in Sitecore SXA which would call a controller action or a rest Api ?
This question is not SXA specific question. It's Sitecore MVC question.
You can see how it's done for Login, Logout renderings. Both of them use
Html.BeginForm() helper. The disadvantage of this is that page will reload once you click submit button. At the same time, it is good because there is security protection (
@Html.AntiForgeryToken()) against cross-site request forgery.
Another way would be JS call (AJAX Request) but there is no snippet for that in the SXA code.
You should review the answers for those keywords: "call controller action sitecore mvc"
I am sure you will find something.