Overview
The upsert method creates or updates a record depending on whether it already exists or not. If a matching record exists, it will be updated. Otherwise, a new record will be created. The request body accepts the following properties which specify how to create or update the record:Property | Behavior |
---|---|
match | Values to match against existing records. At least one of these values must be a unique attribute to avoid matching more than one record. Any number of additional attribute values (unique or non-unique) can also be specified. |
create | Values to fill in if a new record is created. All required attributes on the object must be specified here or the request will fail. |
update | Values to overwrite if an existing match is found. These values will replace any existing values on the record. |
defaults | Values to fill in if there is not already an existing value for them. When creating a record, these will be populated in addition to any create values. When updating a record, these will never overwrite existing values but will be used for attributes that are curently empty. |
match
in the request which defines the value(s) that will be
used to find a matching record. In addition, you must specify either create
or
defaults
. Otherwise, all properties are optional.
The upsert method is the most reliable way of sending data into Unify, so if
you’re not sure what method to use, this is the one we recommend.
Examples
Upsert a company
Upsert a company
This creates or updates a company record:If there’s already a company record in Unify with the domain unifygtm.com,
it will be updated with a status of “Active”. Otherwise, a new record will be
created with the specified values.
Upsert a person
Upsert a person
This creates or updates a person record as well as their associated company
and then links them together:This works because
company
is the name of a reference attribute on the
person object which references a company object record. This request will
create a new company if it doesn’t already exist, update it if it does, and
then link this person to that company.The use of defaults
for the company upsert means that we will fill in the
name
and domain
of the company, but if the company already exists, we
won’t overwrite its existing values.Likewise, the use of defaults
for the person upsert means that we will
only fill in the lead_source
of this person record if it is currently
empty or if we end up creating a new record.Upsert a custom record
Upsert a custom record
This creates or updates a record in a custom object called This is a custom object, so all of these attributes are custom attributes
defined for the object. Since this request uses
product_user
:defaults
, these values
will be filled in if the record is created or if the existing record
doesn’t already have values for them.Usage
Authorizations
Path Parameters
Body
application/json
Request body for upserting a record.
The attribute values to match against to find an existing record.
The attribute values to use when creating a new record if no match is found.
The attribute values to use when updating an existing record if a match is found.
Default attribute values to apply during both creation and update operations.