Everyone loves data, I am sure of it… The key difference though, is most people in their right mind, simply wouldn’t admit it. Data is useful, particularly in this day and age, in what is now commonly referred to as the Information Age.
Now, you might be thinking I am crazy – and that is probably true – but data is the life-blood of modern-day organisations. So what happens when can’t query, transform or extract your data because you hit Salesforce API Limits?
Intro to APIs….
Ok, ok – I hear you. What the hell is an API limit? For that matter, what the f*** is an API? And why should you care?
Starting at the beginning (feel free to skip this section if you already know this!)…
An API, or Application Programming Interface, is at its most basic a way programs or systems talk to each other. I am way over-simplifying things here. But an API ultimately allows one piece of software to communicate with another piece of software in an agreed way.
Software, like Salesforce, is built to be a relatively open platform. And they do this by using a number of APIs to allow other bits of software to communicate and link to it. These links allow developers to do things like query, extract, create or update records within Salesforce with relative ease.
Salesforce supports SOAP API, REST API, BULK API, Streaming API, Metadata API, etc…. So there is a number of ways to access what you need.
Tools you may use as an Admin everyday, use a variety of these APIs. For example, DataLoader uses the SOAP/REST/BULK APIs depending on its setup. Likewise Workbench supports APIs too, as it can connect and manipulate data, query the fields, test API connections within Salesforce.
Even tools like Salesforce for Outlook use APIs to query records and insert attachments. And as an admin this is why you should care. These tools, along with many others, use APIs to connect to Salesforce.
But with great power, comes great responsibility…
So with all these connections into and out of Salesforce globally, surely that can slow down the platform?
That is what brings us to the Salesforce API limits.
Salesforce is a multi-tenanted platform, meaning no-one company has an exclusive server/computer/machine setup for them, everyone shares the infrastructure which drives the platform. So being cloud-based, Salesforce needs to ensure the performance of the platform works for everyone.
To do that, Salesforce impose limits. Governor Limits, Storage Limits, Per User Limits…. All based on the version you have bought from them.
These limits are designed primarily to cap usage of the platform, ensuring stability of the platform and still give a fair amount of flexibility. All the while, also providing a potential upsell opportunity for extra Salesforce services (eg Data Storage limit).
Salesforce API Limits
Among these limits though are API Limits. And even though you normally shouldn’t notice there are limits in place, when you do hit the limits – especially when you hit them unexpectedly – it can be a little jarring…
System.Web.Services.Protocols.SoapException: REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
This is the error which stops all work via APIs… If you rely on APIs to connect to your systems – you really don’t want to see this message!
In this example, a connection using the SOAP API to connect into Salesforce has reported the Request Limit has been exceeded…
Diagnosing API usage…
As an Admin, to diagnose the issue the first port of call is to analyse and find out how you hit the limit.
Every org has quick look view at the API limits. So go ahead – check for yourself. Go to Setup | Quick Find | System Overview to see what you have within your org (if you have access to the Setup/Config of your org that is…).
Firstly, all this really confirms is what has happened. Like a car not starting, you have confirmed there is a problem – but you haven’t diagnosed the issue.
When is 24hrs, not 24hrs?
And secondly, when is the 24hrs? Is it a rolling 24hr period, is it the start of each day local time or even the start of the day in San Francisco?
Well, the good news is this limit is a rolling 24hr period. Meaning it shows you the last 24hrs, from the time you are checking the limit. This is important to know, if you have a lot of batch processes which might be scheduled at specific times of the day.
Is that all the information you need?
Does that really help you though? Overall it doesn’t really give you much insight as to what has really happened within your org.
So, what about Company Information? There is an API Request Limit there too…. (Go to Setup | Quick Find | Company Information)
Nope… still not much help! In this example (yes, two different orgs), we can see the API Limits is 98.9% at the limit for the day. So you will likely start to see problems with API connections…
API Usage Last 7 Days
On the Help page, Salesforce referenced an ‘API Usage Last 7 Days’ report, but didn’t mention where I could find the actual report!
The help article advises that you need: ‘View Setup and Configuration’ permission on your to see this report. I definitely have this permission within the org…. But I still couldn’t find the report:
Then I was reminded about the fact Salesforce comes with some generic but useful standard reports. And guess what is included in the folder!? Yep, an API Usage Report 🙂
But you need to go via the Administrative Reports folder in Classic to view it… Go to Reports | Folders | Administrative Reports:
If that doesn’t work for you, you can also use this URL hack (thanks to Joshua) to jump to the report within your org:
https://na1.salesforce.com/00O?rt=104&retURL=%2F00O&c=UN&c=FULL_NAME&c=EM&c=CID&c=TS&c=CC&duel0=FULL_NAME%2CUN%2CEM&scope=organization&details=yes Replace the na1 with your instance. Below is the same url without the na1.salesforce.com /00O?rt=104&retURL=%2F00O&c=UN&c=FULL_NAME&c=EM&c=CID&c=TS&c=CC&duel0=FULL_NAME%2CUN%2CEM&scope=organization&details=yes
The report gives you a great breakdown to see what/who is using up your Salesforce API Limits over the last 7 days. But it doesn’t fix the overall issue. The fix itself can be as complex as the software/tool that is causing the API Limit to be used up!
But at least you can now diagnose the issue and decide if you can fix the issue, alternatively if it is something you aren’t likely to be able to fix/reduce you can sometimes buy additional API Limits from Salesforce by speaking with your AE…