Follow

Save Subscriber

The Save command allows you to import new Subscribers and data into the database or update existing subscribers without creating a subscription to a particular list.

Arguments

The Save command requires the following arguments: Command and Data.

cmd=save&data=email,first,last,custom_user_id,custom_favorite^jayne.doe@domain.com,Jayne,Doe,112,blue

The command is ‘save' and the subscriber with email 'jayne.doe@domain.com'  will be created.

The Save command expects as least one field in the Data argument.  The email address of the subscriber is always required in order to create a subscriber record.  If the subscriber does not yet exist, a Subscriber record will be created using the email address and first name as the primary key.  If the subscriber does exist, the Subscriber record will be updated with any data defined in additional Data fields.  If allow_duplicates is defined in the header and the first name is different from an existing subscriber, a new subscriber will be created.

To clear a data field, you must be using version 8.8.0 or newer.  If a field is left blank in the command, it will be ignored.  You can clear a data field by sending the string 'NULL'.  For example:

cmd=save&data=email,first,last,custom_user_id,custom_favorite^jayne.doe@domain.com,Jayne,Doe,112,NULL

You can change one or many subscribers with the same Save command.  To update multiple Subscriber records, include additional subscribers separated by the carat (^) character.  Each additional subscriber must have the same number of data fields defined.

To update the subscriber selected format, use format_number or format_text in the Data field definition.

The Save command supports the following arguments:

 

Name

Req?

Description

Argument

Command

Yes

Defines the command to use.

cmd=save

Realm

 

Name of the realm to run the command.  This is optional, and only necessary when submitting files to a parent realm to manipulate data for a child realm

realm=[realm_name]

Data Yes Subscriber related data.  Email is always required, and additional fields are optional.

data=[fields]

 

Example

Using all commands and arguments (please note the command is wrapped for display purposes only):

cmd=save&realm=myrealm_child&data=email,first,last,custom_id,format_number ^*jane@domain.com,Jane,Doe,112,1 ^*jane@domain.com,JD,Doe,114,1 ^john@domain.com,John,Smith,1738,1

Three subscriber records will be created or updated in the realm ‘myrealm_child’, a child of the Realm defined in the header.  If a record for the subscriber with the same email address and first name already exists, then the record will be updated.  If the record does not exist, then a new record will be created with the first name, ‘Jane’, last name, ‘Doe’, and custom field “id” set to ‘112’.

Customer Key Example

Some systems have the ability to define a unique Customer Key per subscriber.  If your realm has Customer Key enabled, then you must include the customer_key in the data argument along with email.  For example:

cmd=save&realm=myrealm_child&data=customer_key,email,first,last,custom_id,format_number ^11293,jane@domain.com,Jane,Doe,112,1

If the Customer Key is not included, the command will fail.

Errors

A Save command will fail if multiple subscribers with the same email exist.  Since Subscriber records are allowed to have the same Email address as long as the First Name is unique, you may wish to include the first name in your Subscribe command to avoid encountering errors or updating the wrong Subscriber.

 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk