[SalesForce] REST API Inbound Integration – Quick Question

Need your inputs for our following requirement.

We have a team of folks who want to have a list of Cases (with selected fields) from our Salesforce instance.
None of these folks have access or license in Salesforce and they have asked us to build a REST API to expose Cases from Salesforce.

Our development team is thinking of developing the following

Build a REST API (GET HTTPMETHOD)which will accept the following parameters

=> Begin Date

=> End Date

=> Queue

The objective as you can see is to provide a list of all the cases belonging to a specific case queue for a frame of time.

Questions

1) What is the maximum number of records that can be sent as Response (JSON) ?…What is the suggested limit ?

2) In a scenario where we send like 100 records to them and if they fail to receive it…what will happen and how we (Salesforce team) will know ?

3) What if they query for like 100000 records and how we can split the result set into batches and send it to them ?

Best Answer

I hope the below answers will help you to create a better solution:

  1. What is the maximum number of records that can be sent as Response (JSON) ?...What is the suggested limit ?

    Answer:
    CPU limit ,Heap size limit etc all will generally apply as same applied in normal apex class.
    Records: 50,000 records in a rest api context
    DML Statements: 150 DML
    SOQL Statements: 100 SOQL limit of context
    Response Size : 3 MB
    API Requests: Each request sent to rest apex class will count against number of API calls to your org & number of API calls allowed for your org depends on edition and as well as licenses.

  2. In a scenario where we send like 100 records to them and if they fail to receive it...what will happen and how we (Salesforce team) will know ?

    Answer: If rest service is not able to receive the request or failed, it will return the response with error message and status code.

  3. What if they query for like 100000 records and how we can split the result set into batches and send it to them ?

    Answer: I think there is no way to do this in rest API. as it returns only 50,000 records in transition. I think instead of using apex rest-api, use standard rest api to perform a query which can result in batches but for that you have to give access to your folks.

Note: As you have mentioned folks have no access or license in Salesforce, then you have to expose the rest apex class publically which can be a security breach!!

Related Topic