0

I'd like to create an account and then a contact in the same call using bulk api. I've used composite api calls to create an account and contact in the same API request.

I would now like to do the same using the bulk api (as i'm trying to import millions of entries). I know i can create all the accounts first, retrieve the account ids, and then create the contacts with the account ids mapped to the correct contact (which would be two calls).

Is there a way to composite the account and contact creation in the single call with bulk api?

Cheers, Ankur

3
  • The composite sobject api can create hundreds of records per call.
    – sfdcfox
    Commented Apr 2, 2020 at 17:11
  • Oh really? According to the documentation it can only handle 25 subrequests in a single call
    – Ankur22
    Commented Apr 2, 2020 at 17:26
  • Yes, and each sub-request can include up to 200 records, which you can then refer in subsequent sub-requests using referenceId values.
    – sfdcfox
    Commented Apr 2, 2020 at 18:23

1 Answer 1

1

No, you can't use the Bulk API to create multiple object types at the same time. Every Bulk API job uses exactly one sObject.

Note that the notion of a "call" looks rather different in the Bulk API. Every Bulk API job you run will involve multiple API calls. You'll create a job, push batches into that job, close the job, poll for completion, and download results, each of which is at least one API call.

4
  • So, just to be clear, relationship fields in records can only be used to update, not to create records? Commented Jul 8, 2020 at 12:43
  • Sorry @BrianKessler, I'm not quite sure what you mean. You can match relationships on an upsert - is that what you're aiming at?
    – David Reed
    Commented Jul 8, 2020 at 14:39
  • If I understand correctly, if we use either JSON or XML with the Bulk API, we can include data for parent relationships in calls to the Bulk API. Maybe I don't understand correctly (I find the bulk API a little confusing), but I'm wondering if we could leverage this to insert both the child and the parent concurrently with the Bulk API. Commented Jul 9, 2020 at 7:33
  • 1
    No, that feature only allows you to map relationship fields through an idLookup or External Id field on the parent object. It doesn't insert or update the parent.
    – David Reed
    Commented Jul 9, 2020 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .