SharePoint: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator

While making a REST query to a SharePoint list from non admin user I got  this error:
The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
The list in question had more than million items. The issue was resolved by disabling list throttling. This can be done using power shell or via code by setting SPList.EnableThrottling to false.