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
Ethan HanEthan Han 

Bulk API relationship field importing returns error

According to the API documentation:

https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_xml_rel_fields.htm

the it should be able to make relationship between objects but when I followed the instruction, I get an error below:

[
{
"success": false,
"created": false,
"id": null,
"errors": [
{
"message": "Unexpected JsonMappingException: Cannot deserialize instance of reference from START_OBJECT value { or request may be missing a required field\n at [Source: java.util.zip.GZIPInputStream@5889e6b8; line: 4, column: 26]",
"fields": [],
"statusCode": "INVALID_FIELD",
"extendedErrorDetails": null
}
]
},
{
"success": false,
"created": false,
"id": null,
"errors": [
{
"message": "Json Deserialization failed on token 'Author_ID__c' and has left off in the middle of parsing a row. Will go to end of row to begin parsing the next row",
"fields": [
"Author_ID__c"
],
"statusCode": "INVALID_FIELD",
"extendedErrorDetails": null
}
]
}
]


request url:
https://myinstance--sandbox1.my.salesforce.com/services/async/44.0/job/batch_id/batch

request body:
[
    {
        "Name":"Test Title",
        "Contributor_lookup__c":{"Author_ID__c":"test-user-id"}
    }
]
I'm hoping anyone here can help me what I'm doing wrong.
Thank!
Best Answer chosen by Ethan Han
Raj VakatiRaj Vakati
I guess you have to send your body as like below 


 
[
    {
        "Name":"Test Title",
        "Contributor_lookup__r":{"Author_ID__c":"test-user-id"}
    }
]