Skip to content

REST API v1 (legacy) ​

Warning

REST API v1 is obsolete. We recommend the new REST API.

The SARE REST API works over HTTP and HTTPS (encrypted connections). Select individual functions by calling the corresponding file.

acq.php ​

API reference for the script that adds or checks an address in the customer's database.

1. Input parameters (GET or POST) ​

NameDescriptionRequiredType
s_uidUser's UID in SAREYESString
s_keyUnique subscription keyYESString
s_emailEmail address, up to 255 charactersYESString
s_gsmMobile number (SMS module) in +48… formatNOString
s_encodedCharacter encoding: ‘utf-8’ (default), ‘iso-8859-2’, ‘iso-8859-1’NOString
s_group_[0-31]Group to join; defaults to 0 (none). Example: s_group_2=1&s_group_4=1NOBool
s_nameName fieldNOString
s_commentDescription fieldNOString
s_typeSubscribed newsletter format: ‘text,HTML’ for HTML + TXT (default), ‘text’ for plain textNOString
s_property[1-9]Additional property fieldsNOString
s_cust_[nazwa]Extended property fields, according to the structure defined in the systemNOString/Enum
s_interfaceSubscription interface number, 1-9; defaults to 0NOInteger
s_ipSubscriber's IP addressNOString
s_no_sendIf set, sends no confirmation request and displays no page; returns mainkey only (“key=????????”). Defaults to 0NOBool
s_rvIf set, displays no page and returns the result code only. Defaults to 0NOBool

Warning

Encode string parameters, for example with urlencode().

2. Return values and error codes (only when s_rv=1) ​

Return valueDescription
1Address added successfully
4Address exists in the database but has not been confirmed
7Address exists but is blocked by an operator
8Address exists and is already confirmed
-1Missing required parameter
-2Invalid email address syntax
-3Invalid UID syntax
-4Invalid subscription key
-5Invalid mobile number syntax
-97API limit set
-98Invalid UID
-99Database connection error

3. Examples ​

3.1 Add user@domena.pl to the database for customer UID=001 with global key 16c609d3451133ec09231:

http://s.enewsletter.pl/acq.php?s_uid=001&s_key=16c609d3451155ec09231&s_email=user@domena.pl

Defaults: UTF-8 character encoding and text/HTML message format.

3.2 Add user@domena.pl to customer UID=001 with global key 16c609d3451155ec09231, using text messages and ISO encoding:

http://s.enewsletter.pl/acq.php?s_uid=001&s_key=16c609d3451155ec09231&s_email=user@domena.pl&s_encoded=iso-8859-2&s_type=text

3.3 Return the result code only:

http://s.enewsletter.pl/acq.php?s_uid=001&s_key=16c609d3451155ec09231&s_email=user@domena.pl&s_rv=1

4. Testing ​

Invalid calls display only an error message. Use s_rv=1 to check the error code.

SARE ignores attempts to add the same email address again within 10 minutes. In this case it returns 1 (with s_rv=1 enabled), which may make test results misleading.

upd.php ​

API reference for the script that updates email addresses in the customer's database.

1. Input parameters (GET or POST) ​

NameDescriptionRequiredType
s_uidUser's UID in SAREYESString
s_mkeyUnique key of an address in the customer's databaseYESString
s_gsmMobile number (SMS module) in +48… formatNOString
s_encodedCharacter encoding: ‘utf-8’ (default), ‘iso-8859-2’, ‘iso-8859-1’NOString
s_group_[0-31]Group to join; defaults to 0 (none). Example: s_group_2=1&s_group_4=1NOBool
s_groupoff_[0-31]Group to leave; defaults to 0 (none). Example: s_groupoff_2=1NOBool
s_nameName fieldNOString
s_commentDescription fieldNOString
s_typeSubscribed newsletter format: ‘text,HTML’ for HTML + TXT (default), ‘text’ for plain textNOString
s_property [1-9]Additional property fieldsNOString
s_cust_[nazwa]Extended property fields, according to the structure defined in the systemNOString/Enum
s_ipUpdating user's IP addressNOString
s_redirectURL to redirect to after the updateNOString

Warning

Encode string parameters, for example with urlencode().

2. Return values and error codes (only when s_rv=1) ​

Return valueDescription
1Address updated successfully
7Address exists but is blocked by an operator
-1Missing required parameter
-2Invalid email address syntax
-3Invalid UID syntax
-4Invalid address key
-5Invalid mobile number syntax
-97API limit set
-98Invalid UID
-99Database connection error

3. Examples ​

3.1 Set ISO encoding and TXT format for newsletters sent to the address with key 51133ec09231 in customer UID=001's database:

http://s.enewsletter.pl/upd.php?s_uid=001&s_mkey=51133ec09231&s_encoded=iso-8859-2&s_type=text

3.2 Change the name of the address with key 51133ec09231 in customer UID=001's database and redirect to www.sare.pl:

http://s.enewsletter.pl/upd.php?s_uid=001&s_mkey=51133ec09231&s_nazwa=Nazwa&s_redirect=http://www.sare.pl

3.3 Move the address with key 51133ec09231 in customer UID=001's database from group 1 to group 2:

http://s.enewsletter.pl/upd.php?s_uid=001&s_mkey=51133ec09231&s_group_2=1&sgroupoff_1=1

4. Testing ​

The script changes only the data included in the call parameters. For example:

http://s.enewsletter.pl/upd.php?s_uid=001&s_mkey=51133ec09231

does not change any database data.

Do not pass the email address to modify: it is identified by the s_mkey key.

chk.php ​

API reference for the script that checks an address in the database.

1. Input parameters (GET or POST) ​

NameDescriptionRequiredType
s_uidUser's UID in SAREYESString
s_keyUnique subscription keyYESString
s_emailEmail address, up to 255 charactersYESString

Warning

Encode string parameters, for example with urlencode().

2. Return values and error codes (only when s_rv=1) ​

Return valueDescription
8Subscribed and confirmed
7Blocked address
6Subscribed, not confirmed
5Subscribed, not verified
4Requested unsubscribe
3Unsubscribed
2Manually unsubscribed
0Address not in the database
-1Missing required parameter
-2Invalid email address syntax
-3Invalid UID syntax
-4Invalid subscription key
-97API limit set
-98Invalid UID
-99Database connection error

3. Examples ​

3.1 Check user@domena.pl in the database for customer UID=001 with global key 16c609d3451133ec09231:

http://s.enewsletter.pl/chk.php?s_uid=001&s_key=16c609d3451155ec09231&s_email=user@domena.pl

rm.php ​

API reference for the script that removes email addresses from the customer's database.

1. Input parameters (GET) ​

NameDescriptionRequiredType
uUser's UID in SAREYESString
keyUnique subscription keyYESString
mkeyUnique key of an address in the customer's databaseYESString
mlMailing code to updateNOInteger

2. Examples ​

2.1 Remove the address with key 9994c from the database for customer UID=001 and master key ba1957be5:

http://s.enewsletter.pl/rm.php?u=001&key=ba1957be5&mkey=9994c

2.2 Remove the address with key 9994c from the database for customer UID=001 and master key ba1957be5, and update mailing 5567cd:

http://s.enewsletter.pl/rm.php?u=001&key=ba1957be5&mkey=9994c&ml=5567cd

3. Testing ​

The script does not validate the ml argument (mailing code).

Addresses are not physically removed from the database; only their status changes. The same address can therefore be “removed” repeatedly.