Claude, Salesforce API.

An empty response from Salesforce's REST API is not a failure, since PATCH returns 204 No Content on success. The video covers instance URLs, Describe, and why a Composite call's outer 200 does not prove every subrequest worked.

2:05 video3 min readWatch on YouTube

Someone updates a Salesforce record with PATCH, gets an empty response, and assumes it failed. The video explains that it did not: PATCH returns 204 No Content on success. It then covers how a real failure looks, what a call needs before it touches a field, and a caveat about Composite calls that is easy to miss.

Silent success, loud failure

A clean PATCH update comes back as 204 with nothing in the body, and the video says that emptiness is the success. A failure looks different. Get a field name wrong and the response carries a real body, this time a JSON array with an error code inside it.

The video sums it up this way: success stays silent, and failure always talks back, never as a plain object. That shape difference is how you tell the two apart.

Instance URL, Describe, then query

Every call needs the org's own instance URL. That is the org's My Domain plus the versioned data path, and there is no shared endpoint across orgs.

Before touching a field, the video describes the object using Describe, which shows field names, picklist values, and which fields are actually updateable. It then queries the open Opportunities closing this quarter, with account name and owner, and pulls the Id of the top match. That is the record about to change.

The update itself

With the Id in hand, the video patches that record's StageName to Closed Won. The response comes back 204 and empty, which is exactly what a successful update looks like.

The Composite caveat

Things change when several updates are chained in one Composite call. There the outer response returning 200 does not mean every subrequest succeeded. Each subrequest carries its own httpStatusCode, and only checking those tells you which writes landed and which did not.

A single failed subrequest also does not undo the others unless allOrNone was set to true. Without it, the batch is partial and the successful writes stay.

Trust the code, not the silence

The video's summary has two parts. An empty response is not a failure, because 204 with no body is what success looks like, so trust the status code rather than the silence. And when one call carries several writes, check each one's own code, not just the one wrapping it.

Key takeaways

  • PATCH returns 204 No Content on success, so an empty body is the success.
  • A real failure carries a body: a JSON array containing an error code.
  • Every call needs the org's own instance URL, which is My Domain plus the versioned data path.
  • Describe an object to confirm field names, valid picklist values, and which fields are updateable.
  • A Composite call's outer 200 does not prove every subrequest succeeded.
  • Each subrequest has its own httpStatusCode that must be checked.
  • A failed subrequest does not undo the others unless allOrNone is true.

Try it yourself

Ask Claude to find all open Opportunities closing this quarter, with account name and owner, then update the top one to Closed Won. Watch three things. Does it set the org's real instance URL before making any call? Does it describe the Opportunity object to confirm StageName is updateable and Closed Won is a valid picklist value before writing? And does it check the actual status code afterward instead of treating an empty response as a failure?

Chapters

  1. 0:00An empty response from Salesforce means my update failed. Right?
  2. 0:12Silent success, loud failure
  3. 0:32Instance URL, Describe, then query
  4. 0:58204, then the Composite caveat
  5. 1:29Carry-out
  6. 1:47Your turn
Full transcript(auto-generated, with timestamps)

An empty response from Salesforce means my update failed. Right?

[0:00]Someone updates a Salesforce record with patch, gets an empty response back, and assumes it failed. It didn't. Patch returns 204 no content on success. So, how do you tell a real failure apart? Patch a Salesforce record and a clean

Silent success, loud failure

[0:13]Update comes back as 204 with nothing at all in the body. That emptiness is the success. Get a field name wrong instead and the response carries a real body this time, a JSON array with an error code inside it. Success stays silent. Failure always talks back and never as a plain object. Every call needs the org's own instance

Instance URL, Describe, then query

[0:32]URL. It's my domain plus the version data path. There's no shared endpoint across orgs. Before touching a field, describe the object field names, picklist values, and which fields are actually updatable. Query the open opportunities closing this quarter with account name and owner and pull the ID of the top match. That's the record about to change. Patch that ID's stage name to closed one and the response comes back 204 empty and exactly what a successful update looks like. Chain

204, then the Composite caveat

[0:58]Several updates in one composite call instead and the outer response returning 200 doesn't mean every sub request succeeded. Each one carries its own HTTP status code and only checking those tells you which wrote and which didn't. A single failed sub request doesn't undo the others, either. Unless all or none was set to true. Otherwise, the batch is partial rights stay. An empty response from Salesforce isn't a failure. 204 with no body is what success looks like. Trust the status code, not the silence. And when a call carries several rights at once, check

Carry-out

[1:29]Each one's own code, not just the one wrapping it. Your turn. Here's the prompt. Read it with me. Find all open opportunities closing this quarter with account name and owner, then update the top one to closed one. Watch three things. Does it set the org's real instance URL before making any call? Does it describe the opportunity object to confirm stage name

Your turn

[1:48]Is updatable and closed one is a valid picklist value before writing? And does it check the actual status code afterward instead of treating an empty response as a failure. Liam Inforbear Cloud Salesforce API Liam Inforbear

More from Claude Basics

Humanitarians AI Lyrical Literacy Project