Skip to main content

Updating records

Changing an existing record with PATCH.

Update has to be granted first

Your administrator ticks Update for that object before this works — see Setting up a key. Until then you get a 403.

The request​

PATCH <endpoint>/Contact/003Bi00000Qr0uRIAR
x-easycrm-client-id: <your Client ID>
x-easycrm-secret: <your Secret>
content-type: application/json
{
"Title": "QA Lead",
"Phone": "5551234567"
}

What comes back​

{
"object": "Contact",
"id": "003Bi00000Qr0uRIAR",
"updated": true,
"externalId": "EXT-000096"
}

200 OK. As with create, updated is always true — a failure arrives as an error status, not as false.

Only what you send changes​

PATCH means "change these fields, leave everything else alone". Send a phone number and only the phone number moves; the name, the owner and every other field stay exactly as they were.

There is no PUT

PUT means "replace the whole record", so anything you did not send would be wiped. Send { "Phone": "..." } as a strict PUT and the Name, the Type and the owner would all blank out. Salesforce's own REST API uses PATCH for the same reason, and so does this one.

Addressing the record​

Two ways, both PATCH:

ByRequest
Salesforce IdPATCH <endpoint>/Contact/003Bi00000Qr0uRIAR
Portal External IdPATCH <endpoint>/Contact?externalId=EXT-000096

Both reach the same record and answer identically.

There is no upsert​

You cannot say "create this, or update it if it already exists" in one call.

The reason is the External Id itself: it is an AutoNumber, generated by Salesforce, and nobody can write it. It can address a record that already exists, but it can never carry a key that you chose.

Why that rules upsert out

An upsert matches on a key you supply. Since you can never supply this one, the match half would fail on every call and fall through to "no match — create one". Every retry would quietly add another duplicate.

Create and update are kept separate so that cannot happen.

If you need to find out whether a record exists first, read it:

GET <endpoint>?object=Contact&externalId=EXT-000096

count: 0 means there is nothing there yet.

Which fields you may set​

Exactly as for creating a record: the key's writable fields and the portal user's own field access are two separate gates, and both refuse by naming the fields in a 400 rather than ignoring them.

A field you cannot edit is refused, not skipped

The portal's save would otherwise skip such a field and still answer 200 {"updated": true} with nothing actually written. This API refuses the whole request instead and tells you which field it was.

One record per call​

No arrays. One PATCH, one record, one answer.

Validation rules still apply​

The same validation rules, required fields and triggers run as when somebody edits the record on screen. A refusal comes back as a 400 carrying the rule's own message.

Next​

Deleting recordsremoving a record
Errors and limitsevery refusal, and the write ceiling