function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhilash Mishra 13Abhilash Mishra 13 

SOAP API Limit Exceed

Hi,
I have 10000+ records on my mysql database. Using php tool kit I am trying to  insert them in salesforce,
How ever while doing so I am getting api Limit Exceed error. How can I optimise it, I am not using any batch job.  just simple create function

Best Answer chosen by Abhilash Mishra 13
Temoc MunozTemoc Munoz
Hi Abhilash.

You will need to create a batch process in PHP. The limit in a single create() is 200 objects.

You can:
1. load your data from a CSV and call create() on every 200 objects
2. manually create your data in the php file
3. Retrieve 200 records from mySQL directly and then call on create() and repeat the process again

Thanks

All Answers

Temoc MunozTemoc Munoz
Hi Abhilash.

You will need to create a batch process in PHP. The limit in a single create() is 200 objects.

You can:
1. load your data from a CSV and call create() on every 200 objects
2. manually create your data in the php file
3. Retrieve 200 records from mySQL directly and then call on create() and repeat the process again

Thanks
This was selected as the best answer
Pavan WaghmodePavan Waghmode
Hey Abhilash,

I am not much aware about php coding. but i am posting here is the one vb.net code example that will help you to otimise your code.
So you can convert the same in php to work in batch job insert process.

Private binding As apexPartner2015.SforceService---SOAP wsdl reference object
        Dim sfContacts(dt.Rows.Count - 1) As apexPartner2015.sObject   
    Dim xmlDocumentObj As New XmlDocument
    For I = 0 To dt.Rows.Count - 1  ----(dt is datatable contain 200 records return by query)
               
      //field binding logic
        xmlElementObj(0) = xmlDocumentObj.CreateElement("firstname")
        xmlElementObj(0).InnerText = dt.Rows(I).Item("firstname")
        xmlElementObj(1) = xmlDocumentObj.CreateElement("lastname")
        xmlElementObj(1).InnerText = dt.Rows(I).Item("lastname")

                binding.AssignmentRuleHeaderValue = Nothing
                sfContact = New apexPartner2015.sObject             
                sfContact.type = CRMType
                sfContact.Any = xmlElementObj               
                sfContacts(I) = sfContact
    Next
            Dim saveResults() As apexPartner2015.SaveResult = Nothing              
            saveResults = binding.create(sfContacts)   

Please let me know if you need more details.