3

I see that Bulk API 1.0 supports JSON payload as the content type for insert operations. However, I cannot ascertain if Bulk API 2.0 also supports JSON.

In my Job Create body I've tried sending:

{
"operation":"insert",
"object":"Account",
"contentType":"JSON"
}

The response I receive back from Salesforce is:

    {
        "errorCode": "UNSUPPORTEDCONTENTTYPE",
        "message": "UnsupportedContentType : JSON is not a valid Content-Type. Only 'CSV' is allowed"
    }

which obviously leads me to believe that JSON isn't supported. I'm just unclear why Bulk API 1.0 would support JSON payloads, but Bulk API 2.0 does not?

I would prefer to use Bulk API 2.0, as I am more comfortable with REST than SOAP.

So question is - has anyone successfully used Bulk API 2.0 with JSON and if so, what was your contentType specified in your job create body (or other workaround)?

2

Looking at the Bulk API 2.0 documentation, it does not support any other contentType except for CSV. Below is the excerpt from the documentation:

The content type for the job. The only valid value (and the default) is CSV.

As for your question:

I'm just unclear why Bulk API 1.0 would support JSON payloads, but Bulk API 2.0 does not?

It all depends on the product offering as which features are to be provided in which version. If you see the below excerpt from the documentation, it's based on same REST principles but it allows some simple processing and that there are few things which are not supported in this version.

Salesforce provides an additional API, Bulk API 2.0, which uses the REST API framework to provide similar capabilities to Bulk API. Use Bulk API 2.0 instead of Bulk API if you want a simplified process for inserting, updating, upserting, or deleting large sets of data. Bulk API 2.0 does not currently support query or queryAll.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.