Batch API query

Anonymous
Not applicable

Batch API query

Hi,

We are using rest API for creating leads with URL: /rest/v1/leads.json

The API allows multiple inputs in 1 API call with maximum limit of 300.

We have query regarding error handling for the API:

Lets assume there are 100 records in one API call. For some reason(endpoint is down etc), API fails for each record starting from 51st.

In such case, will we get succcess response for 50 created records and error message/s for each of the rest 50 records?

Or

is there any rollback mechanism implemented, i.e. API returning failure for batch call itself.

Thanks

Tags (2)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Batch API query

I don't think you can get partial acks -- you can test it easily by pulling the plug right after the request stage is finished -- but realize that even if a back end request were wrapped in a transaction, just because the endpoint goes down for you doesn't mean the transaction wouldn't be committed on the server before they began to send the response.

Tricky thing about HTTP request-response traffic:the liveness of the underlying TCP connection is typically not checked until there's response data to send. So data can be committed to the back end before the web server layer learns that the response cannot be sent.

Anonymous
Not applicable

Re: Batch API query

Thank you for the reply Sanford.

But when I mentioned, endpoint is down I meant server endpoint. To be clear ,if there is any problem at the server side, e.g. database is down etc starting from 51st record in a batch of 100, what will be the response ? Will it be 50 successful records and 50 failure records(1 for each failure) in response structure? or  will it be failure response for whole batch of 100 records that is no record in batch is processed and commited.

Regards,

Deepali

SanfordWhiteman
Level 10 - Community Moderator

Re: Batch API query

You should check the sync status for each object in the response array.  This is true regardless of whether there's a "rollback" per se.