Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Функция Function users/import

Параметры запросаQuery parameters:

  • token - ключ авторизации полученный через функцию authauthorization key obtained through the auth function
  • users - список импортируемых пользователейusers list for import
  • users[i].title - ФИО пользователя (обязательное полеuser full name (mandatory field)
  • users[i].email - Email пользователя user email (обязательноеmandatory, уникальное полеunique field)
  • users[i].phone - Номер телефона (с кодом страныphone number (with country code)
  • users[i].country - Страна доставки пользователя по умолчанию (не используется если выключена функция выбора стран в заказеuser's default delivery country (not used if country selection at checkout is disabled)
  • users[i].city - Город доставки пользователя по умолчаниюuser's default delivery city
  • users[i].address - Адрес доставки пользователя по умолчаниюuser's default delivery address
  • users[i].discount_card - Персональная скидка пользователяuser's personalized discount
    • users[i].discount_card.discount - размер скидки discount amount (%)
    • users[i].discount_card.active - включение/отключение персональной скидкиenable/disable personal discount
    • users[i].discount_card.date_limit - срок действия скидки (Формат ГГГГ-ММ-ДДdiscount validity period (Format YYYYY-MM-DD)
    • users[i].discount_card.status - статус скидкиdiscount status
      • 1 - подтвержденаconfirmed
      • 2 - ожидает потдвержденияpending confirmation
      • 3 - отклоненаrejected



Info
titleNote

Parameters for Cartum b2b

  • users[i].customer_group_id - id группы покупателей, к которой относится пользовательID of the customer group to which the user belongs
  • users[i].balance - сумма баланса пользователя, может быть отрицательнойthe amount of the user's balance, may be negative
  • users[i].balance_currency - валюта баланса пользователяuser balance currency
  • users[i].manager_id- id менеджера магазина, закрепленного за пользователемID of the store manager assigned to the user
  • users[i].site_link - строка, ссылка на сайт пользователяstring, a link to the user's website
  • users[i].company - строка, название компании пользователяstring, user's company name
  • users[i].role - строка, должность пользователя в компании

Параметры ответа

  • status - Статус выполнения запроса
  • OK - Все пользователи запроса были успешно добавлены/обновлены
  • WARNING - Некоторые пользователи не были добавлены/обновленыstring, user's position in the company


Response parameters:

  • status - query execution status
    • OK - all users of the request were successfully added/updated
    • WARNING - some users weren't added/updated
  • response.log - Журнал обновленияupdate log
    • response.log[i].code - Код сообщений (см. таблицу нижеmessage code (see table below)
    • response.log[i].message - Расшифровка сообщения

Коды сообщений журнала

...

    • message text value


Log message codes


CodeValue
0User was successfully imported/updated
1Missing mandatory fields
2Field validation error
3Unhandled error


Code Block
titleПример запросаQuery example
POST http://<DOMAIN>/api/users/import/
Content-Type: application/json

{
  "token": "<TOKEN>",
  "users": [
    {
      "title": "ИвановIvanov Иван ИвановичIvan",
      "email": "ivan@mail.net",
      "phone": "+380631234567",
      "country": "УкраинаUkraine",
      "city": "КиевKyiv",
      "address": "ул.Khreschatyk ПушкинаSt, д. Колотушкина22",
      "discount_card": {
        "discount": 3,
        "active": true,
        "date_limit": "2019-01-01",
        "status": 1
      }
    },
    {
      "title": "ИвановаIvanova Елена ОлеговнаElena",
      "email": "elena@mail.net",
      "phone": "+380631234567",
      "country": "УкраинаUkraine",
      "city": "КиевKyiv",
      "address": "ул.Khreschatyk КрещатикSt, д. 1",
      "discount_card": {
        "discount": 3,
        "active": true,
        "date_limit": "2020-01-01",
        "status": 1
      }
    },
    {
        "email": "some@email"
    }
  ]
}


Code Block
titleПример ответаResponse example
{
    "status": "WARNING",
    "response": {
        "log": [
            {
                "info": [
                    {
                        "code": 0,
                        "message": "Обновление пользователяUser ivan@mail.net update завершеноcompleted успешноsuccessfully!"
                    }
                ]
            },
            {
                "info": [
                    {
                        "code": 0,
                        "message": "Обновление пользователяUser elena@mail.net update завершеноcompleted успешноsuccessfully!"
                    }
                ]
            },
            {
                "info": [
                    {
                        "code": 1,
                        "message": "ПолеThe email field (some@email) заданоis set некорректноincorrectly!"
                    }
                ]
            }
        ]
    }
}