Below is my code to retrieve my org's limits. However, access token refreshes every now and then. How can I get my own org's limits programmatically without using HttpRequest to avoid access token?
HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setEndpoint(Url.getSalesforceBaseUrl().toExternalForm()+'/services/data/v43.0/limits'); req.setHeader('Authorization','Bearer ' + UserInfo.getSessionId());
But, I get the error:
Session expired or invalid","errorCode":"INVALID_SESSION_ID
So I wanted to find another way to retrieve my org's limits.