Departments and Employees

SailPlay defines a department as any composite (or logical) part of the partner (i.e. you). The department can be a store, a warehouse, a cash register, a mobile application (as a type), or a part of a website (or the entire website). Accordingly, store_department_id - is the ID of the partner's department in the SailPlay system.

An employee is a department unit that / who can be authorized to process purchases, award gifts, etc. An employee can be an individual person or a part of the system. It is important that each employee has a personal PIN-code used for signing all transactions. Each employee can work in one department. If an employee should be able to process transactions in a different department, you should create this employee in that department. PIN-codes should be unique within the frame of one department.

Thus, all analytics is departments- and employees-based.

Methods:

/Api/v2/partners/departments/create/ - adding a department

Use

Is used to add a department into the SailPlay system.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes name  Department name. For example, "Landing - sales 1". Or "Pharmacy No. 12"
no kind  Type of the department ( "site" - a website (or its part), "default" - human-run department)
no origin_id  Department ID in your system
no country  Country (for example, "USA")
no region  Region (for example, NY State)
no city  City (for example, "New York")

Server Response

Parameter Name Parameter Description
status  
kind  Department type.
origin_id  Department ID in your system. It is used for future requests. Format - a string. Example: "landing123" or "pos-13412".
id  Department ID in SailPlay system (also store_department_id)
name  Department name
store_department_key   The key for authorization in the SailPlay system. See detailed The More  found here .

Request Example

http://sailplay.net/api/v2/partners/departments/create/?store_department_id=47&token=0a5f9516698a3c9c2d34394fa8df9474307193c8&kind=default&origin_id=cash120&country=%D0%A0%D0%BE%D1%81%D1%81%D0%B8% D1% 8F & region =% D0% 9C% D0% BE% D1% 81% D0% BA% D0% B2% D0% B0 & city =% D0% 9C% D0% BE% D1% 81% D0% BA% D0% B2% D0% B0 & name = Cashregister & 20120

Response Example

{ 
"The status": "ok The",
"kind": "the default",
"origin_id": "cash120",
"id": 79,
"name": "the Cash The register 120"

The example of the response if the parameter name is not specified:

{ 
"The status": "error",
"STATUS_CODE": -1000,
"the message": "the Provide name parameter"
}

 

/Api/v2/partners/departments/list/ - departments list

Use

Receiving the list of departments

Request Parameters

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

Server Response

Parameter Name Parameter Description
status  
departments Array of objects presented as:
origin_id Department ID in your system.
id Department ID in SailPlay system (also store_department_id)
key Private key (also store_department_key)
name Department name

Request Example

http://sailplay.net/api/v2/partners/departments/list/?store_department_id=37&token=0a5f9516698a3c9c2d34394fa8df9474307193c8

Response Example

{ 
"The status": "ok The",
"the departments":
[
{
"origin_id": "U1231",
"id": 5,
"name": "Store No.17 in",
"key": "123 907 788"
},
{
"origin_id": "the Site / landing1",
"id": 37,
"name": "Landing page",
"key": "9231239788"},
{
"origin_id": "Cash123",
"id": 63
" name ":" Cash register 123 ",
" key ":" 1321907788 "}
]
}

/Api/v2/partners/managers/create/ - adding an employee

Method's Use

Creation of the employee's account in the SailPlay system.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes role  Employee role seller, manager or administrator ( "seller", "manager", "admin", accordingly)
yes dep_id  Department ID (also store_department_id)
no first_name  Employee Name
no second_name  Employee Surname

Server Response

Parameter Name Parameter Description
status  
manager Object with the following fields:
id ID of the employee's entry in the SailPlay system.

Request Example

 http://sailplay.net/api/v2/partners/managers/create/?store_department_id=37&token=0a5f9516698a3c9c2d34394fa8df9471307193c8&dep_id=37&role=seller&first_name=Alex

Response Example

{ 
"The status": "ok The",
"manager Have":
{
"id": 203
}
}

/Api/v2/partners/managers/delete/ - deleting an employee

Method's Use

Deletion of an employee from the SailPlay system.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes id  Employee's ID in the SailPlay system.

Server Response

Parameter Name Parameter Description
status  
manager Object with the following fields:
id ID of the employee's removed entry in the SailPlay system.

Request Example

 

Response Example

{ 
"The status": "ok The",
"manager Have":
{
"id": null
}
}

 

/Api/v2/partners/managers/edit/ - editing employee data

Method's Use

Editing employees data, including change of the role. 

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes id  Employee's ID in the SailPlay system.
yes role  Employee role seller, manager or administrator ( "seller", "manager", "admin", accordingly)
yes dep_id  Department ID (also store_department_id)
no first_name  Employee Name
no second_name  Employee Surname

no pin_code  New PIN-code

Server Response

Parameter Name Parameter Description
status  
manager Object with the following fields:
id ID of the employee's edited entry in the SailPlay system.

Request Example

  http://sailplay.net/api/v2/partners/managers/edit/?store_department_id=37&token=0a5f9516698a3c9c2d34394fa8df9471307193c8&dep_id=37&role=seller&first_name=Alex

Response Example

{ 
"The status": "ok The",
"manager Have":
{
"id": 203
}
}

/Api/v2/partners/managers/history/ - employee actions history

Method's Use

Returns employee actions history

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes id or phone  Employee ID or phone number (if it was specified during registration).
yes page  Data is displayed per page with 30 entries on one page
yes fetch_by (purchase or gift_purchase)  History data (purchases, awarded gifts, accordingly)

Server Response

Parameter Name Parameter Description
status  
history Object with the following fields:
total_pages Number of pages
page Current page
purchases Array of objects presented as:
price Purchase price
order_num Order number
is_completed Checkbox: is the transaction confirmed?
id (it also purchase_id) Transaction ID
points_delta Received bonus points
user Object presented as:
phone Phone number
first_name Name
last_name Surname
origin_user_id  

Request Example

  http://sailplay.net/api/v2/partners/managers/history/?store_department_id=37&token=0a5f9516698a3c9c2d34394fa8df9474307193c8&id=92&fetch_by=purchase&page=10

Response Example

{ 
"The status": "ok The",
"the history": {
"purchases": [
{
"price": 300,
"PURCHASE_DATE": "2013-10-15T22: 02: 30",
"order_num": "314"
"is_completed": to true,
"completed_date": "2013-10-15T22: 02: 30",
"id": 9936,
"points_delta": 45,
"the user":
{
"Image phone": "Phone: +7 (916) 2 *** - 19 ",
" the first_name ": null,
" last_name ": null,
" origin_user_id ": null
}
}
" total_pages ": 15,
" page ": 10
}
}

/Api/v2/partners/managers/list/ - employees list

Method's Use

Returns the list of employees in this department

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
no page  The list is displayed per page with 50 employees on one page. The parameter page is used for the request to receive data from a particular page.

Server Response

Parameter Name Parameter Description
status  
total_pages Total number of pages
page Current page number
managers Array of objects presented as:
last_name Employee Surname
first_name Employee Name
phone Employee phone number (if there is a number; if there is no number, then use "no phone")
phone_humanized Employee phone number in a readable form
role Employee role (admin, manager, seller)
is_superuser Department ID in the SailPlay system.
id Employee's ID in the SailPlay system.
pin_code Employee PIN-code

Request Example

http://sailplay.net/api/v2/partners/managers/list/?store_department_id=37&token=0a5f9516698a3c9c2d34394fa8df9474307193c8

Response Example

{ 
"The status": "ok The", "total_pages": 1,
"page": 1,
"the managers":
[
{
"last_name": "Torres is",
"Image phone": "79000000000",
"the first_name": "by Andrea" ,
"phone_humanized": "Phone: +7 (000) 000-00-00",
"role": "admin",
"name": "",
"is_superuser": to true,
"the department": 37,
"id": 92 ,
"pin_code": "5972"
},
{
"last_name": "\ u0421 \ u043e \ u0442 \ u0440 \ u0443 \ u0434 \ u043d \ u0438 \ u043a",
"Image phone": "the no Image phone",
"the first_name": " \ u041a \ u0430 \ u043a \ u043e \ u0439- \ u0442 \ u043e ",
" phone_humanized ":" the no Image phone ",
" role ":" admin ",
" name ":" \ u041a \ u0430 \ u043a \ u043e \ u0439- \ u0442 \ u043e \ u0421 \ u043e \ u0442 \ u0440 \ u0443 \ u0434 \ u043d \ u0438 \ u043a ",
" is_superuser ": to false,
" the department ": 37,
" id ": 20,
" pin_code ":" 33ei "
}
]
}

/Api/v2/partners/managers/view/ - information about an employee

Use

Returns information about an employee

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  See here
yes store_department_id  See here
yes id or phone  Employee ID or phone number (if it was specified during registration)

Server Response

Parameter Name Parameter Description
status  
manager Object with the following fields:
name Employee Name and Surname
phone Employee phone number
role Employee role
id Employee's ID in the SailPlay system.
auth_hash Manager's auth_hash. May be used for SPanel authorization
pin_code Employee PIN-code
departments Array of objects presented as:
gifts_points_sum Amount of points for all gifts awarded by this employee
points_sum Amount of points for all purchases processed by this employee
department_id Department

Request Example

http://sailplay.net/api/v2/partners/managers/view/?store_department_id=37&token=0a5f9313498a3c9c2d34394fa8df9474307193c8&id=122

Response Example

{ 
"The status": "ok The",
"manager Have":
{
"name": "by Andrea Torres is",
"the departments":
[
{
"gifts_points_sum": 0,
"points_sum": "6494",
"department_id": 5
}
] ,
"Image phone": null,
"role": "seller",
"id": 122,
"pin_code": "1111"
}
}

/Api/v2/partners/employee/create - add employee

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes position_id  Employee's position.
no first_name  employee name.
no last_name  Name of officer.
no middle_name  Middle employee
no birth_date  Birthday employee
no department_id  Department to which the employee is attached.
no sex  Paul (1 male, 2 - for women).
no role_id  A set of employee rights. When you create a client is automatically assigned a role by default - without rights and access to the API.

Sample request

http://sailplay.ru/api/v2/partners/employees/create/?department_id=64&position_id=77&origin_id=102&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Career": [
    {
      "Position_id": 77,
      "Id": 6
      "End_date": "",
      "Department_id": 64,
      "Start_date": "2015-11-11"
    }
  ]
  "Id": 454
  "Pin_code": null,
  "Last_name": null,
  "Role_id": 5,
  "Department_id": 64,
  "Email": null,
  "Middle_name": null,
  "First_name": null
}

When you create an employee record it automatically populated with the first record in his career.

/Api/v2/partners/employee/edit - Editing

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes position_id  Employee's position.
no first_name  employee name.
no last_name  Name of officer.
no middle_name  Middle employee
no birth_date  Birthday employee
no department_id  Department to which the employee is attached.
no sex  Paul (1 male, 2 - for women).
no role_id  A set of employee rights.

Sample request

http://sailplay.ru/api/v2/partners/employees/edit/?employee_id=453&origin_id=102&first_name=alexander&last_name=jobs&birth_date=1990-01-01&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Career": [
    {
      "Position_id": 77,
      "Id": 5
      "End_date": "",
      "Department_id": 64,
      "Start_date": "2015-11-11"
    }
  ]
  "Id": 453,
  "Pin_code": "1605",
  "Last_name": "jobs",
  "Role_id": 5,
  "Department_id": 64,
  "Email": "rukovod1@mail.com",
  "Middle_name": null,
  "First_name": "alexander"
}

/Api/v2/partners/employee/delete - delete employee

Removing blocks employee access to employee personal cabinet and stops the calculation of a KPI employee.

To restore the access to SailPlay, contact your account manager.

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.

Sample request

http://sailplay.ru/api/v2/partners/employees/delete/?employee_id=453&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Manager": {
    "Id": 453
  }
}

/Api/v2/partners/employee/list - getting the list of employees

API provides a list of employees at the Department ID or ID position.

If appropriate parameters are not passed, the list of employees will be refunded.

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
no department_id  ID department to which the employee is attached.
no position_id  ID Officer.
no page  Page Number issuance.

In response to a query returns a summary of the employee:

parameter name parameter Description
id  employee ID.
first_name  employee name.
last_name  Name of officer.
position_id  ID Officer.
department_id  ID department to which the employee is attached.

Sample request

http://sailplay.ru/api/v2/partners/employees/list/?dep_id=64&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Total_pages": 1,
  "Managers": [
    {
      "Phone": "",
      "Id": 451,
      "Position_id": 35
      "Last_name": "shan",
      "Role_id": 1,
      "Email": null,
      "Pin_code": "4971",
      "Middle_name": null,
      "Department": 64,
      "First_name": "woll"
    }
    {
      "Phone": "",
      "Id": 452,
      "Position_id": 35
      "Last_name": "shan2",
      "Role_id": 1,
      "Email": null,
      "Pin_code": "9871",
      "Middle_name": null,
      "Department": 64,
      "First_name": "will2"
    }
  ]
  "Page": 1
}

/Api/v2/partners/employee/view - obtaining information about the employee

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.

In response, all information about the client will be refunded.

Sample request

http://sailplay.ru/api/v2/partners/employees/view/?employee_id=453&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Id": 453,
  "Career": [
    {
      "Position_id": 77,
      "Id": 5
      "End_date": "",
      "Department_id": 64,
      "Start_date": "2015-11-11"
    }
  ]
  "Phone": "",
  "Birth_date": "1990-01-01",
  "Middle_name": null,
  "First_name": "alexander",
  "Pin_code": "3180",
  "Department_id": 64,
  "Last_name": "jobs",
  "Role_id": 5,
  "Status": "ok",
  "Email": "rukovod1@mail.com"
}

/Api/v2/partners/roles/ list - get a list of roles

This method requires no parameters other than token, store_department_id, and pin_code.

Sample request

http://sailplay.ru/api/v2/partners/roles/list/?token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Roles": [
    {
      "Id": 1,
      "Name": "seller",
      "Description": ""
    }
    {
      "Id": 2
      "Name": "manager",
      "Description": ""
    }
    {
      "Id": 3,
      "Name": "sender_manager",
      "Description": ""
    }
    {
      "Id": 4
      "Name": "admin",
      "Description": ""
    }
  ]
}

/Api/v2/partners/employees/add - adding a record in his career

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.
Yes position_id  Employee's position.
Yes dep_id  ID card records.
Yes from_date  Date of commencement of work.
no to_date  Date of completion of the work. If not specified - an employee in the position to this day ..

Sample request

http://sailplay.ru/api/v2/partners/employees/career/add/?employee_id=457&position_id=77&start_date=2014-01-01&department_id=64&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "End_date": null,
  "Position_id": 77,
  "Id": 11
  "Department_id": 64,
  "Start_date": "2014-01-01T00: 00: 00"
}

/Api/v2/partners/employees/edit - Editing records

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.
no position_id  Employee's position.
no dep_id  ID card records.
no from_date  Date of commencement of work.
no to_date  Date of completion of the work. To remove a completion date in the value must be passed null.

Sample request

http://sailplay.ru/api/v2/partners/employees/career/edit/?employee_id=457&career_item_id=9&position_id=77&start_date=2012-01-01&end_date=2013-01-01&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "End_date": "2013-01-01T00: 00: 00"
  "Position_id": 77,
  "Id": 9
  "Department_id": 64,
  "Start_date": "2012-01-01T00: 00: 00"
}

/Api/v2/partners/employees/list - get a list of records

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.

Sample request

http://sailplay.ru/api/v2/partners/employees/career/list/?employee_id=457&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Career": [
    {
      "Position_id": 77,
      "Id": 11
      "End_date": "",
      "Department_id": 64,
      "Start_date": "2014-01-01"
    }
    {
      "Position_id": 77,
      "Id": 9
      "End_date": "2013-01-01",
      "Department_id": 64,
      "Start_date": "2012-01-01"
    }
  ]
}

/Api/v2/partners/employees/delete - deleting entries

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes employee_id  employee ID.
Yes career_enrty_id  career record identifier.

Sample request

http://sailplay.ru/api/v2/partners/employees/career/list/?employee_id=457&career_item_id=9&token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
}

/Api/v2/partners/positions/add - add post

Options:

This parameter is required? parameter name parameter Description
Yes token  See. Here
Yes store_department_id  See. Here
Yes name  Post Title.

Sample request

http://sailplay.ru/api/v2/partners/positions/add/?name=Руководитель of Sales & token = c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7 & store_department_id = 64 & pin_code = 6607

Example response

{
  "Status": "ok",
  "Id": 77
  "Name": "Sales Manager"
}

/Api/v2/partners/positions/list - get a list of posts

This method does not require additional parameters

Sample request

http://sailplay.ru/api/v2/partners/positions/list/?token=c699d95ebbb33a1c35e2f0c8e8a44df3ba55daa7&store_department_id=64&pin_code=6607

Example response

{
  "Status": "ok",
  "Positions": [
    {
      "Is_default": true,
      "Id": 35
      "Name": "Default position"
    }
    {
      "Is_default": false,
      "Id": 77
      "Name": "Sales Manager"
    }
  ]
}
 

/partner-login-by-hash/ - WEB-interface login (SPanel)

May be used for authorization to WEB-interface of SailPlay from another system, it is necessary to use a special url and auth_hash as authorization parameters.

Options:

This parameter is required? parameter name parameter Description
yes auth_hash  The authorization token received in the earned for a specific manager by api/v2/partners/managers/view/ method
yes partner_id  Partner ID (displayed in the lower-right corner of the interface or may be obtained from the manager).
no config  Allows passing alias of SPanel configuration file (used to load pages in modified styles).

Sample request

https://sailplay.net/partner-login-by-hash/?auth_hash=3f95047fb74d61f9264330ae1cfa0b6e63734a3876&config=client_conf&partner_id=1681

In the case of correctly substituted data, the user will be authorized in the SailPlay WEB interface

Attention! The described method can be used only after its activation for the specified partner_id.
To activate the method for any partner_id, you should contact the SailPlay manager.