The shops mode allows to import sales points, networks, formats, cities and regions, as well as to appoint a responsible person for a shop.

The JSON fields for creating a shop:

Name Type Description Example
create_users Integer Allowed (1) or not allowed (0) to create non-existent users 1
region_id Integer Region id
region_name String Region name
city_id Integer Existing city id
city_name String City name Moscow
network_id Integer Existing network id
network_name String Network name Perekrestok
network_format_id Integer Existing format id
network_format_name String Network format name Better 25
shop_id Integer Existing shop id
shop_name String The shop address
shop_col1 String Unique identifier of the shop (from SAP or another client's system) sd233
shop_short_desc String Short description of the shop, displayed in a list Sole proprietor "Ashot"
shop_long_desc HTML Detailed description of the shop, displayed on its page
shop_lat Float Latitude
shop_lng Float Longitude
sv_* Supervisor data
asm_* ASM data
um_* Territorial manager data
kam_* КАМ data
aud_* Auditer data

Notes:

  • If the structure allows to transfer both ID and name, it will be updated and the search by ID will be performed. Or the search by name will be performed and, if the record is not found, it will be created.
  • The region is optional. If it is not set, the city will be linked to the first region in the database;
  • Latitude and Longitude are optional. If they are not set, locationwill be determined by Google Maps;
  • Responsible persons for shops are optional;
  • The employee's data structure is described here;
  • If the employee is not in the database, a new record will be created (if create_users == "1") or an error will be returned.

Request returns the JSON object with the following fields:

Name Type Description
shop_id Integer Sales point id
city_id Integer City id
network_format_id Integer Sales point formate id
network_id Integer Trade network id

Example:

var json=[
  {
    "y"   :567,
    "hash":{
      "create_users"       :1,
      "city_name"          :"Москва",
      "network_name"       :"Перекресток",
      "network_format_name":"Better 25",
      "shop_name"          :"ул. Марсксистская, д. 1к1",
      "sv_name"            :"Иванов Иван Иванович"
    }
  }
];
$.ajax({
  method:"POST",
  url:"https://demo2.easymerch.ru/api/dataset_import/",
  data:{
    "login"      :"admin",
    "password"   :"password",
    "do-login"   :1,
    "no-session" :1,
    "m"          :"shops",
    "json"       :JSON.stringify(json)

  },
  success:function(ret) { console.log(ret); }
});

Результат:

{
  "ok":1,
  "items":[
    {"y":567,"ret":{"ok":1,"update":{"shop_id":123,"city_id":12}}}
  ]
}