General Information about dataset_import

The "dataset_import" method allows to import data to the following directories:

  • Regions;
  • Cities;
  • Retail networks;
  • Retail network formats;
  • Stores;
  • Availability matrices by formats;
  • Availability matrices by stores;
  • Employees;
  • Visit plans;
  • Promotions.

General request structure:

Field name Data type Field value
login String Login of user who makes import
password String User passwrod
do-login Integer 1
no-session Integer 1
m String Import mode, example: "trip_plans"
json JSON JSON containing an array of objects (specific for each mode)

Example:

var json=[
  {"y":1,"hash":{/*данные*/}},
  {"y":2,"hash":{/*данные*/}},
  {"y":3,"hash":{/*данные*/}}
];
$.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":1,"ret":{"error":"Несуществующий регион"}}},
    {"y":2,"ret":{"error":"Неверные атрибуты пользователя"}}},
    {"y":3,"ret":{"ok":1,"update":{"shop_id":123,"city_id":12}}}
  ]
}

Import URL:

https://servername.easymerch.ru/api/1c_shops_import/