1

I am attempting to update a custom object using the Salesforce REST API as described here, but I consistently receive this 400 response

[
    {
        "message": "The HTTP entity body is required, but this request has no entity body.",
        "errorCode": "JSON_PARSER_ERROR"
    }
]

I have tried appending ?_HttpMethod=PATCH to the url and switching to a POSTcall, but while that yields 200 OK, it doesn't actually update the object. The object is "updateable" and I do have permission to edit it. Editing it directly in Salesforce works without issues.

Here is my (cleaned) request, as exported from Insomnia [Version 5.14.9 (5.14.9.1895)].

curl --request PATCH \
  --url https://myInstance.salesforce.com/services/data/v20.0/sobjects/CUSTOMOBJECT/CUSTOMOBJECTID \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
    "Additional_Information__c": "Test additional information"
}'

Any ideas on how I can resolve this?

0

According to the Salesforce documentation for sending HTTP requests with cURL, either a JSON data file needs to be sent or a ".json" extension needs to be appended to the URI.

curl --request PATCH \
  --url https://myInstance.salesforce.com/services/data/v20.0/sobjects/CUSTOMOBJECT/CUSTOMOBJECTID.json \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
    "Additional_Information__c": "Test additional information"
}'
| improve this answer | |

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.