Users import

Function users/import

Query parameters:

  • token - authorization key obtained through the auth function
  • users - users list for import
  • users[i].title - user full name (mandatory field)
  • users[i].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



Note

Parameters for Cartum b2b

  • users[i].customer_group_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 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 - 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
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"
    }
  ]
}
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!"
                    }
                ]
            }
        ]
    }
}