# Users

The User endpoint is a great way to get to know the business employees. There are two types of users in Ristecho: Owner and User. Each account is owned by one Owner. Users can be assigned to specific roles and branches, while account owners will have full authority over all branches.

# The User Object

# Sample

{
  "id": "8cd1956b",
  "pin": "12345",
  "name": "Ben Conroy",
  "number": "4179",
  "email": "bconroy@example.net",
  "phone": "12345678",
  "lang": "en",
  "email_verified": false,
  "is_owner": false,
  "must_use_fingerprint": true,
  "last_cashier_login_at": null,
  "display_localized_names": true,
  "last_login_at": null,
  "created_at": "2019-02-11 07:28:29",
  "updated_at": "2019-02-11 07:28:29",
  "deleted_at": null,
  "notifications": [
    "cost_adjustment_transaction_closed",
    "count_transaction_closed"
  ],
  "branches": [
    {
      "id": "8f7ab00a"
    }
  ],
  "roles": [
    {
      "id": "8f7ab2e2",
      "pivot": {
        "user_id": "8f7ab326",
        "role_id": "8f7ab2e2"
      }
    }
  ],
  "tags": [
    {
      "id": "8f7b9538",
      "pivot": {
        "user_id": "8f7ab326",
        "tag_id": "8f7b9538"
      }
    }
  ]
}

# Attributes

Field Type Rule Description
id string Unique identifier for the user.
is_owner boolean True if user is the account’s owner.
name* string updatable Name of the user.
pin string updatable User pin. available to applications with scope x.
number string updatable User number.
email string updatable User email.
phone string updatable User phone number.
lang* string updatable User language preferance.
display_localized_names boolean updatable Show the console and apps in the localized language.
email_verified boolean True if user email is verified.
must_use_fingerprint boolean updatable True if fingerprints are required.
last_login_at string nullable Time YYYY-MM-DD HH-MM-SS in UTC at which user last logged in.
last_cashier_login_at string nullable Time YYYY-MM-DD HH-MM-SS in UTC at which user last cashier logged in.
roles array updatable includable List of Role objects attched to the user.
branches array updatable includable List of Branch objects attched to the user.
tags array updatable includable List of Tag objects attached to the user.
notifications array updatable includable List of Notifications attched to the user.
created_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was created.
updated_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was updated.
deleted_at string nullable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was deleted.

# Notifications

When attaching a notification type to a user, this user will receive a notification when the specified action occurs in the system inside the branch he belongs to.

Type Details
inventory_item_quantity_below_minimum_level Inventory Item quantity went below the minimum level specified.
inventory_item_quantity_above_maximum_level Inventory Item quantity went above maximum level.
inventory_item_quantity_below_zero Inventory Item quantity went below zero.
inventory_business_date_ended Inventory Business Date Was Ended.
new_purchasing_inventory_transaction New purchasing inventory transaction was made.
new_transfer_sending_inventory_transaction New outbound transfer inventory transaction was made.
new_transfer_receiving_inventory_transaction New receiving inventory transaction was made.
new_production_inventory_transaction New production inventory transaction was made.
new_quantity_adjustment_inventory_transaction New quantity adjustement inventory transaction was made.
new_cost_adjustment_inventory_transaction New cost adjustement inventory transaction was made.
new_count_inventory_transaction New count inventory transaction was made.
new_return_to_supplier_inventory_transaction New return to supplier inventory transaction was made.
new_transfer_order New transfer order was made.
new_pending_transfer_receiving Receiving a new pending transfer.
new_pending_purchase_order New pending purchase order was made.

# List Users

GET /users

# Scope

users.read

# Filters

  • id
  • number
  • name
  • email
  • phone
  • roles.id
  • email_verified
  • branches.id
  • tags.id
  • updated_after
  • has_app_access
  • has_console_access
  • has_roles
  • is_deleted
  • created_on
  • updated_on
  • deleted_on

# Response

{
  "data": [
    {
      "id": "8cd1956b",
      "pin": "12345",
      "name": "Ben Conroy",
      "number": "4179",
      "email": "bconroy@example.net",
      "phone": "12345678",
      "lang": "en",
      "email_verified": false,
      "is_owner": false,
      "must_use_fingerprint": true,
      "last_cashier_login_at": null,
      "display_localized_names": true,
      "last_login_at": null,
      "created_at": "2019-02-11 07:28:29",
      "updated_at": "2019-02-11 07:28:29",
      "deleted_at": null,
      "notifications": [
        "cost_adjustment_transaction_closed",
        "count_transaction_closed"
      ],
      "branches": [
        {
          "id": "8f7ab00a"
        }
      ],
      "roles": [
        {
          "id": "8f7ab2e2",
          "pivot": {
            "user_id": "8f7ab326",
            "role_id": "8f7ab2e2"
          }
        }
      ],
      "tags": [
        {
          "id": "8f7b9538",
          "pivot": {
            "user_id": "8f7ab326",
            "tag_id": "8f7b9538"
          }
        }
      ]
    }
  ]
}

# Get User

GET /users/{userId}

# Scope

users.read

# Response

{
  "data": {
    "id": "8cd1956b",
    "pin": "12345",
    "name": "Ben Conroy",
    "number": "4179",
    "email": "bconroy@example.net",
    "phone": "12345678",
    "lang": "en",
    "email_verified": false,
    "is_owner": false,
    "must_use_fingerprint": true,
    "last_cashier_login_at": null,
    "display_localized_names": true,
    "last_login_at": null,
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null,
    "notifications": [
      "cost_adjustment_transaction_closed",
      "count_transaction_closed"
    ],
    "branches": [
      {
        "id": "8f7ab00a"
      }
    ],
    "roles": [
      {
        "id": "8f7ab2e2",
        "pivot": {
          "user_id": "8f7ab326",
          "role_id": "8f7ab2e2"
        }
      }
    ],
    "tags": [
      {
        "id": "8f7b9538",
        "pivot": {
          "user_id": "8f7ab326",
          "tag_id": "8f7b9538"
        }
      }
    ]
  }
}

# Create User

POST /users

# Scope

users.write

# Request

{
    "pin": "12345",
    "name": "Ben Conroy",
    "number": "4179",
    "email": "bconroy@example.net",
    "password": "password",
    "phone": "12345678",
    "lang": "en",
    "roles": [
        {
            "id": "8cd1956b"
        }
    ],
    "branches": [
        {
            "id": "8cd1956b"
        }
    ],
    "tags": [
        {
            "id": "8cd1956b"
        }
    ],
    "notifications": [
        "new_transfer_order",
        "new_pending_purchase_order"
    ]
}

# Response

{
  "data": {
    "id": "8cd1956b",
    "pin": "12345",
    "name": "Ben Conroy",
    "number": "4179",
    "email": "bconroy@example.net",
    "phone": "12345678",
    "lang": "en",
    "email_verified": false,
    "is_owner": false,
    "must_use_fingerprint": true,
    "last_cashier_login_at": null,
    "display_localized_names": true,
    "last_login_at": null,
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null,
    "notifications": [
      "cost_adjustment_transaction_closed",
      "count_transaction_closed"
    ],
    "branches": [
      {
        "id": "8f7ab00a"
      }
    ],
    "roles": [
      {
        "id": "8f7ab2e2",
        "pivot": {
          "user_id": "8f7ab326",
          "role_id": "8f7ab2e2"
        }
      }
    ],
    "tags": [
      {
        "id": "8f7b9538",
        "pivot": {
          "user_id": "8f7ab326",
          "tag_id": "8f7b9538"
        }
      }
    ]
  }
}

# Update User

PUT /users/{userId}

# Scope

users.write

# Request

{
    "pin": "12345",
    "name": "Ben Conroy",
    "number": "4179",
    "email": "bconroy@example.net",
    "phone": "12345678",
    "lang": "en",
    "roles": [
        {
            "id": "8cd1956b"
        }
    ],
    "branches": [
        {
            "id": "8cd1956b"
        }
    ],
    "tags": [
        {
            "id": "8cd1956b"
        }
    ],
    "notifications": [
        "new_transfer_order",
        "new_pending_purchase_order"
    ]
}

# Response

{
  "data": {
    "id": "8cd1956b",
    "pin": "12345",
    "name": "Ben Conroy",
    "number": "4179",
    "email": "bconroy@example.net",
    "phone": "12345678",
    "lang": "en",
    "email_verified": false,
    "is_owner": false,
    "must_use_fingerprint": true,
    "last_cashier_login_at": null,
    "display_localized_names": true,
    "last_login_at": null,
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null,
    "notifications": [
      "cost_adjustment_transaction_closed",
      "count_transaction_closed"
    ],
    "branches": [
      {
        "id": "8f7ab00a"
      }
    ],
    "roles": [
      {
        "id": "8f7ab2e2",
        "pivot": {
          "user_id": "8f7ab326",
          "role_id": "8f7ab2e2"
        }
      }
    ],
    "tags": [
      {
        "id": "8f7b9538",
        "pivot": {
          "user_id": "8f7ab326",
          "tag_id": "8f7b9538"
        }
      }
    ]
  }
}

# Delete User

DELETE /users/{userId}

# Scope

users.write

The API will respond with 200 indicating that the user has been deleted.

# Restore User

PUT /users/{userId}/restore

# Scope

admin.restore

The API will respond with 200 indicating that the user has been restored.

Last Updated: 28/9/2023, 9:17:53 AM