2
votes

I have a batch process which makes a lot of rest api calls to upsert SalesForce records. The Rest api calls start failing after a while with below error. I did check the API limit for my account and, I can confirm I am well within the 24 hour API limits.

Is there an hourly limit to the API calls as well ? I tried searching SalesForce documentation ,but everywhere I just see a mention about 24 hour limits.I could not find any limit on each hour basis.

{
  “errorCode”: “REQUEST_LIMIT_EXCEEDED”,
  “message”: “You have reached the Connect API’s hourly request limit for this user and application.  Please try again later.”
} 
1

1 Answers

3
votes

You haven't hit the Salesforce API limit, which is generally quite high. You've hit the limit for the Chatter REST API, also known as the Connect API. This API has a per user, per application, per hour request limit:

Chatter REST API requests are subject to rate limiting. Chatter REST API has a different rate limit than other Salesforce APIs. Chatter REST API has a per user, per application, per hour rate limit. When you exceed the rate limit, all Chatter REST API resources return a 503 Service Unavailable error code.

The linked document has a number of recommendations for avoiding this rate limit:

  • If you hit limits when running tests, use multiple users to simulate a real-world scenario.
  • When polling for feed updates, do not exceed one poll per minute (60 polls per hour). To return more results in 1 request, increase the page size.
  • When polling for private messages, do not exceed 60 polls per hour.
  • To avoid making multiple requests, cache metered static assets such as file and dashboard renditions (group and user profile pictures are not metered).
  • Each developer on a team should set up 2 connected apps: one for automated testing and one for manual testing and development. Don’t share connected apps with other developers.
  • Use a unique connected app for the production environment.
  • Don’t share connected apps between applications.

Review the list of Chatter REST API resources to determine what you're calling that is subject to these enhanced limits.