Exchange online (MS365): Every customer using the cloud solutions of Exchange Online in combination with a Microsoft 365 subscription must migrate to Graph API. 

Exchange On-Premises hybrid deployments: Customers using a hybrid configuration (Microsoft 365 + Exchange On-Premises) are able to use REST API until March 2023. After that, all REST API requests will be blocked by Microsoft, and we ask you to contact Microsoft for further steps on migration. 

From Microsoft | Using the Outlook REST API (version 2.0): Use REST APIs to access mailboxes in Exchange hybrid deployments (deprecated) - Microsoft Graph 

Recommended: We strongly recommend customers to contact Microsoft support to correctly proceed and migrate according to their setup.