TransWikia.com

Salesforce Postman create job post in xml but not in json

Salesforce Asked on December 30, 2021

I’m following this example to create a job using json:
InvalidUrl Bulk API creating a bulk job using postman

I’ve been successful to use the request body as xml instead of json, but I desire it to be in json. Here is what I tried to mimic in the example

POST url: test.salesforce.com/services/async/48.0/job

headers:

  • Content-Type: application/json
  • X-SFDC-Session: ‘fresh token’

Body

{ 
    "jobInfo": { 
        "operation": "insert",
        "object": "Account",
        "contentType": "JSON",
        "concurrencyMode": "Parallel"
    }
}

I still get this error:

{ "exceptionCode": "InvalidJob", "exceptionMessage": "Unable to parse Job" }

One Answer

The JSON request body doesn't use a top-level jobInfo key. Rather than converting XML-based code, reference the JSON examples in the Bulk API Developer Guide:

Example JSON request body

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

Answered by David Reed on December 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP