Sunday, 15 December 2024

REST apex code fetch the API usage

 Apex code fetch the API usage
















API Usage Notifications

 API Usage Notifications

With this feature admins will receive an notification whenever an organisation exceeds a limit for the number of API requests made in a specified span of hours.

Permission needed: Modify All Data

Steps to Create an API Notification

  • Login to Salesforce
  • Go to Setup, and in quick find search and select "API Usage Notification"
  • Click on New and enter the details
    1. Notification Recipient: User who will receive the notification
    2. Threshold: percentage of the rate limit, once exceeded in time interval, notification will flow to the recipient
    3. Notification Interval (Hours): The time for which the number of requests is measured, in hours.



Note: If you change the time period, the new time period does not take effect until after the next notification of the existing time period.
For example, assume you have set the time period to send notifications every hour. Then at 4:05 p.m., you set the time period to send notifications every 24 hours. A last notification from the old time period is sent at 5:00 p.m. The next notification would be sent at 5:00 p.m. the next day.