Skip to main content
Group

Official: Bulk API 2.0

This group is the official discussion forum for customers and partners who are using the Bulk API 2.0. https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm It's a forum for customers to provide feedback, requirements and share ideas. Customers may also leverage this group to collaborate with each other on best practices. This group is maintained and moderated by a salesforce.com employee(s). The content received in this group falls under the official Safe Harbor. Please also see our official Salesforce Customer Community Terms of Use
0/9000

To help prioritize Bulk API 2.0 ingest support for handling failures due to record locking, can you detail why you want this capability in Bulk API 2.0?  What problem does Bulk API 2.0 not handling failures due to record locking cause you?  We have some assumptions why this feature is requested and would like to validate to help prioritize. 

 

Please don't specify because Bulk API v1 supports serial mode.  We're looking to understand the underlying problem this lack of capability causes you.

0/9000

 

Can I get some help, I'm having trouble getting Bulk V2 API to accept csv data:  

 

Below is the final portions of my script (python): 

 

1. I successfully login and authenticate (so have the instance_url) 

2. Then, I compile/gather csv data: csv_data = df.to_csv(index=False)  #-- from a pandas dataframe 

-------------------------------------------------------------------------- 

From here, this is what is run:  

-------------------------------------------------------------------------- 

    bulk_api_v2_url = f"{instance_url}/services/data/v62.0/jobs/ingest/" 

    headers = { 

        "Authorization": f"Bearer {access_token}", 

        "Content-Type": "application/json", 

    } 

    # Create a job 

    job_data = { 

        "object": "Account", 

        "operation": "update", 

        "contentType": "CSV", 

    } 

 

 

    response = requests.post(bulk_api_v2_url, headers=headers, json=job_data) 

    job_id = response.json()["id"] 

 

    upload_url = f"{instance_url}/services/data/v62.0/jobs/ingest/{job_id}/batches/" 

    files = {"file": ("data.csv", csv_data)} 

    response = requests.put(upload_url, headers=headers, files=files) 

 

-------------------------------------------------------------------------- 

Here is a typical response:  

-------------------------------------------------------------------------- 

[{'errorCode': 'BULK_API_ERROR', 'message': 'Wrong content-type for batch (application/json), job is of type: text/csv'}] 

 

I also tried this, with the same message:  

  response = requests.put(upload_url, data=csv_data, headers=headers) 

 

-------------------------------------------------------------------------- 

1. I have tried adjusting the header  "Content-Type" to "text/csv" - but this fails, even in Postman  

 

2. Also tried converting the job-data to json, but the API doesn't seem to support this:  

  -

https://salesforce.stackexchange.com/questions/234791/does-salesforce-bulk-api-2-0-accept-json-as-the-contenttype

 

 

Is there a way to adjust the content type of the batch?  

Other suggestions?  

Thanks ahead of time...  

Jarrell

1 answer
  1. Mar 6, 2025, 9:06 PM

    ok figured this out, on my own:  my headers were incorrect - so I used this:  

     

        headers2 = { 

            "Authorization": f"Bearer {access_token}", 

            "Content-Type": "text/csv", 

        } 

        response = requests.put(upload_url, data=csv_data, headers=headers2)

0/9000

Did you know that you can download your Bulk API 2.0 query results in parallel, or be notified by Platform Events when partial results are available?

 

Read the new blog by @Shireen Nagdive comparing the three mechanisms for downloading Bulk API 2.0 query results:

1. Sequential download of entire results.

2. New parallel downloads (GA in Winter '25 release)

3. New events and partial downloads (Beta in Spring '25 release - now deployed to sandbox orgs)

0/9000

Hello API enthusiasts,

Dreamforce 2024 is approaching, and I am looking for customers and partners who would be excited to share their Salesforce API journey on the Dreamforce stage together with me.  If this is something that excites you, please reach out to me.

Thanks,

Jeremy

0/9000

While performing Upserts to Salesforce using Create job bulk api v2 there are auto-chunked batches being created with 0 records.  Have tried disabling the chunking via header and have also removed trailing lines and returns.  Has anyone experienced this?

10 answers
0/9000
0/9000
0/9000

Salesforce Platform APIs: Ask Me Anything January 2024

 

Join our experts @Jeremy Westerman and @Kris Harrison hosted by Developer Advocate @Philippe Ozil for the January edition of our Salesforce Developers Ask Me Anything series to get all the details you need to succeed.

 

Date: Wednesday January 31, 2024

Time: 9am PT

Theme: Salesforce APIs

Registration: https://bit.ly/sfdevsamajan2024

Salesforce Platform APIs: Ask Me Anything January 2024 Join our experts and hosted by Developer Advocate for the January edition of our Salesforce Developers Ask Me Anything series to get all the deta #API #Platform Developer #Salesforce Platform

 

@Official: Bulk API 2.0 @Official: Composite API @Official: TreeSave API @OpenAPI Specs for Salesforce REST APIs @* Salesforce Platform *

0/9000
1 answer
  1. Aug 11, 2023, 4:49 AM

    @Sirisha Jojode

    Yes, it is possible to have multiple objects in a single API request in Salesforce. This can be achieved using the Composite API, which allows you to perform multiple CRUD operations on different objects within a single HTTP request. The Composite API helps reduce the number of round trips required to interact with the Salesforce platform.

     

    Revert back if anything needed in detail!

0/9000