Methods

/api/v2/users/add/ - adding client's record

Method's Use

The mechanism of the partner's client sign up is implemented in SailPlay. The main use case includes statistics for the client (time of signing up, the first purchase, the first useful action, etc.). Besides, based on the settings, when the client signs up a certain amount of bonus points can be awarded for the registration. The points can also be awarded to the person who invited the new registered client.

 

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed see here.
yes token  see here
yes store_department_id  see here
no user_category_name  User category. More detailed  see here.
no first_name  Name
no last_name  Surname
no middle_name  Patronymic/Middle Name
no birth_date  Date of birth in format YYYY-MM-DD. Year in the date must be greater than the min (1900). Otherwise, the minimum year is set
no sex  Sex 1- male, 2 - female.
no extra_fields  Extra fields that will be in JSON response. Extra fields are separated by commas and can have the following values: auth_hash. Example: &extra_fields=auth_hash
no referrer_origin_user_id, referrer_phone or referrer_email = Allows to set referral links between the created client (referral) and any previously created (referrer) client. If a referrer_ * is not found - new client will be added without referral links.

Server Response

Parameter Name Parameter Description
status  
message Server text response It consists of two parts: if the user has been registered on the server, if the user has been registered as your client. Example: "message": "User is already registered. New client."
complete_date The unique hash (auth_hash) that is returned only if the request included the parameter auth_hash in extra_fields see here).

Request Example

http://sailplay.net/api/v2/users/add/?phone=19251276676&token=3187e3c727e6d94f04e54acae75b1de157f103b0&store_department_id=435&first_name=Max&last_name=Bennett&middle_name=Alexander&birth_date=1987-09-03&sex=1&extra_fields=auth_hash

 

Server Responses Examples

In case of success:

{
    "status": "ok",
    "phone": "19251276676",
    "first_name": "Max",
    "last_name": "Bennett",
    "middle_name": "Alexander",
    "birth_date": "1987-09-03",
    "origin_user_id": null,
    "id": 487997,
    "sex": 1
}

In case of failure (the user is already registered in the system and is a client):

{
    "status": "error",
    "message": "User is already registered.User is already client."
}

/api/v2/users/categories/list/ - receiving categories list

The method is used to receive the list of categories.

Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here

 

Server Response

  • status

  • user_categories - array of objects presented as:

    • members_count - number of users in this category

    • create_date  - date and time of creation of this category

    • name - category name (it is used in all future requests)



Request Example

https://sailplay.net/api/v2/users/categories/list/?store_department_id=3132&token=0a96be0867401601df4c6e8691476bfaaa73f3a7

Response Example

{
"status": "ok",
"user_categories":
[
{
"members_count": 4,
"create_date": "2013-10-02T18:08:29",
"name": "1"
},
{
"members_count": 1,
"create_date": "2013-10-02T18:09:06",
"name": "2"
}
]
}

/api/v2/users/categories/set/ - changing user's category

You can assign the category to the user as follows:

When sending a request for the registration (see method /api/v2/users/add/) add the parameter user_category_name. Request Example:

https://sailplay.net/api/v1/users/reg/?store_department_id=3132&token=0a96be0867401601df4c6e8691476bfaaa73f3a7&user_phone=79266054672&user_category_name=1

When sending the next request for the purchase add the parameter user_category_name. Request Example:

https://sailplay.net/api/v1/purchases/new/?store_department_id=3132&token=0a96be0867401601df4c6e8691476bfaaa73f3a7&origin_user_id=asdf12eh1212kjhk21&price=1001&user_category_name=1&fields=public_key

Using a special method -

/api/v2/users/categories/list/.

Request Example

https://sailplay.net/api/v2/users/categories/set/?user_category_name=1&store_department_id=3132&token=0e96be0867401601dfac6e8691476bfaaa73f3a7&user_phone=79266054672

Request Example

{
"status": "ok",
"message": "User category been installed"
}

/api/v2/users/custom-vars/add/ - Adding a custom variable

This API method is used for adding custom variables. You can find out more about how variables are handled by the SailPlay system here. All variables are handled by the server as strings.

When sending a long string in the variable's value (for example, HTML code), it is recommended to send parameter vars in the POST part of the request.

Request parameters

Is the parameter mandatory? Parameter Parameter description Data type Example
yes token See here. see the request example
token=qx6s4gsdvsdhsdsd
yes store_department_id See here integer
store_department_id=345
yes user_phone, email или origin_user_id Client identifier. For more information address this page. string
type=2
yes

vars

Objects containing the variables added to the user

Key: Name 

Value: Variable data, there are two possible types of such structure -

  1. String, containing the value of a custom variable
  2. Custom variable object, containing the following data:
    • Variable value

    • Display name of the custom variable

JSON Object

Key: JSON String(1-70 characters)

Value:

  1. JSON String
  2. JSON Object
    • JSON String

    • JSON String(1-128 characters)
vars={
"param_name1":{"value":"value1","verbose":"param_name"},
"param_name2":"value"
}

Request example

https://sailplay.net/api/v2/users/custom-vars/add/?user_phone=79251276112&token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435&vars={"param_name1":"value1","param_name2":"value2"}

Server response parameters

Parameter Parameter description Data type Example
status

Request status:

ok — if the request was successful, error — if an error was encountered.

JSON String
"status":"ok"
updated_count Amount of custom variables that changed the value as a result of the request JSON Integer
"updated_count":2
created_count Amount of custom variables that were created as a result of the request JSON Integer
"created_count":0
  • user
    • phone
    • origin_user_id
    • email
  • Object, containing information about a customer that posesses the variable:
    • Phone (if available, otherwise - null)
    • User identifier (if available, otherwise - null)
    • E-mail (if available, otherwise - null)
  • JSON Object
    • JSON String
    • JSON String
    • JSON String
 "user":{
"phone":"71111111111",
"origin_user_id":"a1",
"email":null
 }

 

 

Server response:

{
 "updated_count":2,
 "created_count":0,
 "status":"ok",
 "user":{
"phone":"79251276671",
"origin_user_id":null,
"email":null
 }
}

Possible errors

This pair of store_deprtment_id and token are incorrect or missing in the system.

{
    "status": "error",
    "message": "Permission denied. Provide auth token and store_department_id"
}

Incorrect phone format

{
    "status": "error",
    "message": "Phone is not valid"
}

Incorrect E-mail format

{
    "status": "error",
    "message": "Invalid value of email"
}

Custom variable object is invalid

{
     "status": "error",
     "status_code": -5105,
     "message": "vars must be json object, {\"var_name\": \"var_value\", ...}, max items = 20. name max length = 70, value max length = 255"
}

/api/v2/users/custom-vars/get/ - Retrieving a custom variable

The method allows to receive the variable's value linked to a certain client.

Request parameters

Is the parameter mandatory? Parameter Parameter description Data type Example
yes token See here. see the request example
token=qx6s4gsdvsdhsdsd
yes store_department_id See here integer
store_department_id=345 
yes user_phone, email или origin_user_id Client identifier. For more information address this page. string
email=test@test.com
yes name Name of the variable that will be retrieved in a response for the request string(1-128 characters)
name=var1

Request example

https://sailplay.net/api/v2/users/custom-vars/get/?user_phone=79251276112&token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435&name=visit_date

Server response parameters

Parameter Parameter description Data type Example
status

Request status:

ok — if the request was successful, error — if an error was encountered.

JSON String
"status":"ok"
name Name of the variable, retrieved as a result of the request JSON String
"name": "var1"
value Value of the variable specified in the request JSON Number
"value": "Var value"
  • user
    • phone
    • origin_user_id
    • email
  • Object, containing information about a customer that posesses the variable:
    • Phone (if available, otherwise - null)
    • User identifier (if available, otherwise - null)
    • E-mail (if available, otherwise - null)
  • JSON Object
    • JSON String
    • JSON String
    • JSON String
 "user":{
"phone":"71111111111",
"origin_user_id":"a1",
"email":null
 }

 

Server response example:

{
 "status":"ok",
 "name":"html",
 "value":"03/05/2015",
 "user":{
"phone":"71111111111",
"origin_user_id":"a1",
"email":null
 }
}

Possible errors

This pair of store_deprtment_id and token are incorrect or missing in the system.

{
    "status": "error",
    "message": "Permission denied. Provide auth token and store_department_id"
}

Incorrect phone format

{
    "status": "error",
    "message": "Phone is not valid"
}

Incorrect E-mail format

{
    "status": "error",
    "message": "Invalid value of email"
}


Specified user doesn't have the required variable

 {
     "status": "error",
     "status_code": -5111,
     "message": "Custom variable for user does not exist"
 }

/api/v2/users/custom-vars/delete/ - Custom variable deletion

The following API method is used to delete a specific custom variable for a specific client. In case of the client being the last one posessing the specified variable, the custom variable will also be removed from a response to the  /api/v2/users/custom-vars/list/ request

Request parameters

Is the parameter mandatory? Parameter Parameter description Data type Example
yes token See here. see the request example
token=qx6s4gsdvsdhsdsd
yes store_department_id See here integer
store_department_id=345 
yes user_phone, email или origin_user_id Client identifier. For more information address this page. string
email=test@test.com
yes name Name of the variable that will be deleted as a result of this request string(1-128 characters)
name=var1

Request example

https://sailplay.net/api/v2/users/custom-vars/delete/?user_phone=79251276112&token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435&name=visit_date

Server response parameters

Parameter Parameter description Data type Example
status

Request status:

ok — if the request was successful, error — if an error was encountered.

JSON String
"status":"ok"
name Name of the variable, retrieved as a result of the request JSON String
"name": "var1"
values Value of the variable specified in the request, которое было удалено JSON Number
"value": "Var value"
  • user
    • phone
    • origin_user_id
    • email
  • Object, containing information about a customer that posesses the variable:
    • Phone (if available, otherwise - null)
    • User identifier (if available, otherwise - null)
    • E-mail (if available, otherwise - null)
  • JSON Object
    • JSON String
    • JSON String
    • JSON String
 "user":{
"phone":"71111111111",
"origin_user_id":"a1",
"email":null
 }

 

Server response example:

{
 "status":"ok",
 "name":"html",
 "values":"03/05/2015",
 "user":{
"phone":"71111111111",
"origin_user_id":"a1",
"email":null
 }
}

Possible errors

This pair of store_deprtment_id and token are incorrect or missing in the system.

{
    "status": "error",
    "message": "Permission denied. Provide auth token and store_department_id"
}

Incorrect phone format

{
    "status": "error",
    "message": "Phone is not valid"
}

Incorrect E-mail format

{
    "status": "error",
    "message": "Invalid value of email"
}


Specified user doesn't have the required variable

 {
     "status": "error",
     "status_code": -5111,
     "message": "Custom variable for user does not exist"
 }

/api/v2/users/custom-vars/list/ - Retrieving a list of custom variables available for the partner

The method allows to obtain a list of all the variables tied to a partner. 

Request parameters

Is the parameter mandatory? Parameter Parameter description Data type Example
yes token See here. see the request example
token=qx6s4gsdvsdhsdsd
yes store_department_id See here integer
store_department_id=345 

Request example

http://sailplay.net/api/v2/users/custom-vars/list/?token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435

Server response parameters

Parameter Parameter description Data type Example
status

Request status:

ok — if the request was successful, error — if an error was encountered.

JSON String
"status":"ok"
custom_vars Variable list

JSON Array

  • JSON String
"custom_vars": 
["var1", "var2", "var3"]

Server response example:

{"status": "ok", "custom_vars": ["var1", "var2", "var3"]}

Possible errors

This pair of store_deprtment_id and token are incorrect or missing in the system.

{
    "status": "error",
    "message": "Permission denied. Provide auth token and store_department_id"
}

/api/v2/users/info/ - information about the client

Method's Use

This method is designed to receive information about the client, including data on bonus points, purchases, received gifts, and other information.

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID More detailed see here.
yes token  see here
yes store_department_id  see here
no history  To retrieve the history of the awarding and removing of bonus points, the parameter's value should be set to 1 (history=1)
no subscriptions  To retrieve the status of user's subscriptions (email or SMS), the parameter's value should be set to 1. (subscriptions=1) A corresponding array will be added to the JSON response.
no extra_fields  Extra fields that will be in JSON response. Extra fields are separated by commas and can have the following values: auth_hash. Example: &extra_fields=auth_hash

Server Response

Parameter Name Parameter Description
category  The user category (if there is one, see here).
status  Response status.
origin_user_id  Client ID in the partner's (your) system
last_name  Surname
middle_name  Patronymic/Middle Name
first_name  Name
sex   Sex (1-M, 2-F)
phone  Client's phone number
points

 Summary data for client's points:

 -confirmed - awarded and confirmed

 -unconfirmed - awarded but not confirmed

 -spent - amount of points spent by the client

 -total - amount of all awarded points (confirmed and not confirmed)

email  Client's email
birth_date  Date of birth in format YYYY-MM-DD
id  Client ID in SailPlay.
user_points  Client ID in our system Bonus points available to this user
message Server text response It consists of two parts: if the user has been registered on the server, if the user has been registered as your client. Example: "message": "User is already registered. New client.
media_url Prefix to create URL addresses for gifts images
available_gifts Gifts available to the user
over_user_points_gifts Gifts not available to the user yet
auth_hash The unique hash (auth_hash) that is returned only if the request included the parameter auth_hash in extra_fields (more detailed see here).
history The object with information about all of the user's actions (purchases list, list of the received gifts, etc.)
subscriptions The array with the status of the user's subscriptions (email or SMS)

Request Example

https://sailplay.net/api/v2/users/info/?user_phone=19223260840&token=6b186c1072e1670a93fa8d20bd605193c890a587&store_department_id=1&history=1&extra_fields=auth_hash&subscriptions=1

Server Responses Examples

In case of success:

{
    "category": null,
    "status": "ok",
    "origin_user_id": null,
    "last_name": "Bennett",
    "middle_name": "Alexander",
    "first_name": "Max",
    "sex": 1,
    "phone": "19223260848",
    "points": {
        "confirmed": 2293,
        "total": 2293,
        "spent": 0,
        "unconfirmed": 0
    },
    "email": "support@sailplay.net",
    "birth_date": "1987-09-03",
    "id": 12003,
"subscriptions": ["email_all", "sms_all"],
"history": [ { "action": "extra", "action_date": "2014-04-29T16:22:20", "is_completed": true, "points_delta": 2393, "name": "kjb" }, { "action": "extra", "action_date": "2014-04-19T01:29:34", "is_completed": true, "points_delta": -100, "name": "Points are expired" }, { "action": "extra", "action_date": "2014-04-07T19:49:02", "is_completed": true, "points_delta": -300, "name": "Points are expired" }, { "action": "purchase", "action_date": "2014-04-03T12:00:00", "is_completed": true, "points_delta": 200 }, { "action": "extra", "action_date": "2014-04-03T12:00:00", "is_completed": true, "points_delta": 100, "name": "jr" }, { "action": "registration", "action_date": "2014-03-31T16:36:55", "points_delta": 0 } ] }

{ status: "error", message: "User does not exist."

/api/v2/users/merge/ - merging clients

Method's Use

This method allows the user to merge the history and tags of two clients into one.

 

Is the parameter mandatory? Parameter Name Parameter Description
yes from_phone,from_email or from_oid  ID of the client whose date will be transferred. After the transfer the client will be deleted.
yes token  see here
yes store_department_id  see here
yes to_phone, to_email or  to_oid   ID of the client where the data of the second client will be added.

The example of the message without code

Request:

https://sailplay.net/api/v2/users/merge/?from_phone=11111111111&token=024e3bfbe50c8ef3d413caf19bf5380bbdd79df3&store_department_id=435&to_phone=12222222222

Response:

{
"status": "ok",
"phone": "12222222222",
"origin_user_id": null,
"email": null
}

/api/v2/users/sms-code/ - sending a text message to the client

Method's Use

This method allows the user to send a text message with a unique four-digit code

When sending a request:

  1. A unique code is generated on the SailPlay server

  2. The text message with the pre-set text (if the text is not pre-set, the default text is used) and the code is sent to the designated client

  3. In the response to the request
Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID More detailed  see here.
yes token  see here
yes store_department_id  see here
no text  Customized text message. If it is not pre-set, the default text is used.
no priority  Message transfer channel. 1- fast channel, 2 - standard.

The example of the message without code

Request:

https://sailplay.net/api/v2/users/sms-code/?phone=19251276671&token=6b186c1072e1670a93fa8d20bd605193c890a587&store_department_id=171&text=example of message without code

Response:

{"status": "ok", "sms_code": "7568"}

SMS:

The example of the message without code

 

The example of the message with code

Request:

https://sailplay.net/api/v2/users/sms-code/?phone=19251276671&token=6b186c1072e1670a93fa8d20bd605193c890a587&store_department_id=171&text=Example of message with code. Code-$[sms_code]

Response:

{"status": "ok", "sms_code": "2172"}

SMS:

The example of the message with code. Code-2172

The example of the message with default text

Request:

https://sailplay.net/api/v2/users/sms-code/?phone=19251276671&token=6b186c1072e1670a93fa8d20bd605193c890a587&store_department_id=171

Response:

{"status": "ok", "sms_code": "3082"}

SMS:

Code to use bonuses 3082

 

/api/v2/users/sync-social/ - gathering data via social networks

Method's Use

The method initiates the procedure of receiving the client's data via social networks. 

Before using the method you should provide to SailPlay the authorization data for the networks applications. You can do that via your manager or by sending a description of the desired logic for social networks data processing to support@sailplay.net.

By default, only not filled in fields of the client's card are loaded from social networks. So, if the client has a name, when the method is called, the name will not be rewritten.

If required, the logic of processing individual fields can be changed to rewrite by the update. In this case, when calling for the method, the fields indicated as to be rewritten will be changed.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  user_phone, email or origin_user_id see here.
yes token  see here
yes store_department_id  see here
yes type  ID of a social network from which the data will be received. It can have values vk, fb, ok.
yes account_id  ID of the client in the social network from which the data will be received.
yes access_token  Authorization token of the client in the social network. Methods of receiving the token are to be confirmed in the documentation for the social network.
yes session_secret_key  Authorization token of the client in the social network Odnoklassniki. It is not required for other social networks.

Request Example

https://sailplay.net/api/v2/users/sync-social?type=fb&access_token=CAALZCNDiO1tkBAF2QG46ealvQH2K0x54nKFQDtAofbLrNBEMoKhbtygUjhiwdUR2tKxLWbB5zC4iDFmzT6xrQGb0XZAWtgTCD4oamA1ZAZAWZAEiFZBjBj4uwyhcWMtcDXbuoX7xZB5BNFHPMSS8dHUVcS8z6EcoRflqim8F413Jn9UWngpDd1zimRrSA1V618ZCd2sMpZAYyUpwiXBNUyYMWfZASBZCDd7yxwZD&phone=19999999945&account_id=2679591&store_department_id=219&token=024e5bfbe50c8ef3d413caf19bf5380bbdd79df3

Server Response:

{"status": "ok"}

/api/v2/users/tags/add/ - adding a tag

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed here.
yes token  see here
yes store_department_id  see here
yes tags  assigned tags separated by commas.
no tag_categories  categories of the assigned tags separated by commas. The number of categories should match the number of tags. The category can be empty.

Request Example

https://sailplay.net/api/v2/users/tags/add/?user_phone=19251276112&token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435&tags=Регистрация,A/B-тест #11,A/B-тест #11 вар. А&tag_categories=,Выборка,

Server Response:

{"status": "ok", "added_tags_count": 3}

/api/v2/users/tags/delete/ - deleting a tag

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed see here.
yes token  see here
yes store_department_id  see here
yes tags  to be deleted tags separated by commas  

Request Example

https://sailplay.net/api/v2/users/tags/delete/?phone=19251276112&token=024e3bfbe50c8ef3d413caf19bf5380bbdd79df3&store_department_id=219&tags=mytag

Server Response:

{"status": "ok", "deleted_count": 1}

/api/v2/users/tags/list/ - the list of tags assigned to the client

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed see here.
yes token  see here
yes store_department_id  see here

Request Example

https://sailplay.net/api/v2/users/tags/list/?store_department_id=219&token=024e3bfbe50c8ef3d413caf19bf5380bbdd79df3&origin_user_id=origin1

Server Response:

{
    "status": "ok",
    "events": [
        {
            "update_date": "2014-07-07T14:50:38",
            "kind": "flag",
            "create_date": "2014-07-07T14:50:38",
            "name": "Tagging",
            "is_chains_event": true,
            "sender_name": null,
            "is_campaigns_event": true,
            "sender_templates_vars_help": null,
            "key": "62b80a71ddb37f22d5929e22312438c81024e7b1",
            "group": 4,
            "is_future": false,
            "id": 10000866
        }
    ]
}

/api/v2/users/update/ - changing client's information

Method's Use

The method allows updating information about the client.

The parameters indicated in the method will be rewritten, other parameters will not be changed.

To remove the parameter's value for the client, you need to set the parameter's value to null.

To change the contact data for the client use parameters new_phone and new_email.

Be careful in using these parameters. If the user is linked to the email or the phone number specified in these parameters, purchase and points awarding history will be lost.

To merge the history of several clients use method /api/v2/users/merge/

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed see here.
yes token  see here
yes store_department_id  see here
no user_category_name  User category. More detailed  see here.
no first_name  Name
no last_name  Surname
no middle_name  Patronymic/Middle Name
no birth_date   Date of birth in format YYYY-MM-DD
no sex  Sex 1- male, 2 - female.
no add_phone  If there is no phone number specified for the client, it will assign this number. It gives an error if the phone number has an incorrect format, if the client has already added the phone number or if the transferred number is assigned to another client.
no add_email   If there is no email address specified for the client, it will assign this transferred email. It gives an error if the email address has an incorrect format, if the client has already added the email or if the transferred email is assigned to another client.
no new_phone  The client's phone number that will be linked to the history. It can't be re-assigned with the parameter new_email. 
no new_email  The client's email address that will be linked to the history. It can't be re-assigned with the parameter new_phone.
no extra_fields  Extra fields that will be in JSON response. Extra fields are separated by commas and can have the following values: auth_hash. Example: &extra_fields=auth_hash
no referrer_origin_user_id, referrer_phone or referrer_email = Allows to set referral links between the edited client (referral) and any previously created (referrer) client. If a referrer_ * is not found - edited client will be updated without referral links.

Server Response

Parameter Name Parameter Description
status  
message Server text response It consists of two parts: if the user has been registered on the server, if the user has been registered as your client. Example: "message": "User is already registered. New client."
complete_date The unique hash (auth_hash) that is returned only if the request included the parameter auth_hash in extra_fields (more detailed  see here).

Request Example

https://sailplay.net/api/v2/users/update/?phone=19251276671&token=3187e3c727e6d94f04e54acae75b1de157f103b0&store_department_id=435&first_name=Виталий&last_name=Нестеров&middle_name=Сергеевич&birth_date=1987-09-03&sex=1&extra_fields=auth_hash

 

Server Responses Examples

In case of success:

{
    "status": "ok",
    "phone": "19251276676",
    "first_name": "Max",
    "last_name": "Bennett",
    "middle_name": "Alexander",
    "birth_date": "1987-09-03",
    "origin_user_id": null,
    "id": 487997,
    "sex": 1
}

/api/v2/users/unsubscribe/ - unsubscribing the client from the mailing list

Method's Use

This method is designed to unsubscribe users from various types of mailing lists.

Is the parameter mandatory? Parameter Name Parameter Description
yes user_phone, email or origin_user_id  Client ID. More detailed see here.
yes token  see here
yes store_department_id  see here
yes unsubscribe_list  The mailing lists to unsubscribe the client from, separated by commas

  Possible values unsubscribe_list

  • email_all - all messages sent via email, excluding messages required for the purchase or receiving a gift
  • sms_all - all text messages sent via sms, excluding messages required for the purchase or receiving a gift

Request Example

https://sailplay.net/api/v2/users/unsubscribe/?user_phone=19223260848&token=6b186c1072e1670a93fa8d20bd605193c890a587&store_department_id=1&unsubscribe_list=email_all,sms_all

Server Responses Examples

In case of success:

{
    "status": "ok",
    "user": {
        "phone": "19223260848",
        "origin_user_id": null,
        "email": null
    },
    "unsubscribed": [
        "email_all",
        "sms_all"
    ]
}


/api/v2/users/update-feed/ - receiving the list of users with changes in profiles

Method's Use

This method allows receiving the list of the latest changes in the clients' records in the indicated time period. The period can't exceed 5 days.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  see here
yes store_department_id  see here
yes datetime_from  The start date of the period
no datetime_to  The end date of the period If it is not set, the date will be taken from datetime_from + 5 days.

Server Response

Parameter Name Parameter Description
status  Response status.
datetime_from  The start date of the period from the request
datetime_to  The end date of the period from the request
result   It returns arrays of “user_data” and “actions”
user_data  It returns current information about the buyer (including changes)
actions  It returns the date of the last change and its type

Request Example

https://sailplay.net/api/v2/users/update-feed/?token=264bdf78f8479a243e23fdf798ee84086d832a64&store_department_id=1596&datetime_from=2015-02-10&datetime_to=2015-02-14

Server Responses Examples

 

{
"status": "ok",
   "datetime_to": "2015-02-14T00:00:00",
   "datetime_from": "2015-02-10T00:00:00"
"result": {
        "user_data": {
            "origin_user_id": null,
"first_name": "Vasiliy",
"middle_name": null,
"user_data_updated": "2015-02-13T10:49:52",
"vk_id": null, "sex": null,
"phone": "70000055555",
"last_name": "Pupkin",
"facebook_id": null,
"birth_date": null,
"email": null,
}
        "actions": [
{
             "action_date": "2015-02-13T10:49:52",
"type": "user_data_change"
}
]
}
]
}

 

/api/v2/users/email-registration/complete/ - registration confirmation

The following API method is used for automatic user registration confirmation. When a user is registered through SailPlay authorization form, with the ordinary process they confirm their registration by following a link in an email that is sent after the registration is completed or by entering a sent code into the authorization form. If the appropriate communication chains are disabled or it is required to confirm customer's registration from the side of the partner, this method should be used.

If a customer sends several registration requests with different password values, the last one will be confirmed.

Request parameters

Is the parameter mandatory? Parameter Parameter descripton Data type Example
yes token see here see request example
token=qx6s4gsdvsdhsdsd
yes store_department_id see here integer
store_department_id=345 
yes user_phone, email or origin_user_id Client ID. More detailed see here. string
email=test@test.com

Request example

https://sailplay.net/api/v2/users/email-registration/complete?email=test@test.com&token=b3c7ac443b9b93bf4daa20f5429a655b5f77bb4b&store_department_id=435

Server response parameters

Parameter Parameter description Data type Example
status

Request status:

ok — if the request was successful, error — if an error was encountered.

JSON String
"status":"ok"
warnings

Object that contains warning objects. Warnings supply additional information in case of a successful request. Object will not be returned if there are no warnings. Available warnings:

  • user_already_registered - is returned when the request is sent for an already registered user
JSON Object
warnings: { "user_already_registered" : "true" }

Server response example:

{"wargins": {"user_already_registered": true}, "status": "ok"}

Possible errors

This pair of store_deprtment_id and token are incorrect or missing in the system.

{
    "status": "error",
    "message": "Permission denied. Provide auth token and store_department_id"
}

Incorrect phone format

{
    "status": "error",
    "message": "Phone is not valid"
}

Incorrect E-mail format

{
    "status": "error",
    "message": "Invalid value of email"
}

Specified customer hasn't sent a registration request

 {
     "status": "error",
     "message": "User is not autorized"
 }