Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

VMI user API handler

Manage Vendor Managed Inventory (VMI) user imports and updates.

POST Import VMI Users

HTTP Verb – POST

URL – /api/v1/accounts/vmi/import

Description – Import VMI users with role assignments and location mappings

BaseHandlerBase\<ImportVmiUsersParameter, ImportVmiUsersResult\>

Handlers

OrderHandlerDescription
500ValidateContextValidates that VMI is enabled in OrderManagementGeneralSettings. Verifies the current user is logged in. Checks user roles to determine CanUpdateUsers. If VmiUsers are provided but the user cannot update users, returns Forbidden. Sets the BillTo from the current site context.
600GetUsersIf VmiUsers parameter is empty, bypasses handler. Retrieves UserProfile entities matching the provided user Ids that are associated with the current BillTo customer. Includes customer relationships via eager loading.
700GetVmiLocationsIf VmiUsers parameter is empty, bypasses handler. Retrieves VmiLocation entities matching the location names from the import data. Filters to active locations assigned to available ship-to customers.
800UpdateUsersIf no users were found, bypasses handler. For each user, updates VMI roles (removes existing VMI_Admin and VMI_User roles, then adds specified roles). Assigns customers associated with the specified VMI locations using the account pipeline. Updates RolesChangedOn timestamp for non-guest users.
900SetImportVmiUsersResultCopies the VmiUsers parameter to the result for the response.

PATCH Update VMI User

HTTP Verb – PATCH

URL – /api/v1/accounts/vmi/{vmiUserId}

Description – Update a VMI user's role and location assignments

BaseHandlerBase\<UpdateVmiUserParameter, UpdateVmiUserResult\>

Handlers

OrderHandlerDescription
500ValidateContextRetrieves the UserProfile by the specified UserId (includes customer relationships). Returns NotFound error if the user does not exist.
600UpdateRoleIf Role is blank and RemoveVmiPermissions is false, bypasses handler. Removes existing VMI_Admin and VMI_User roles. If RemoveVmiPermissions is true, updates RolesChangedOn and exits. Otherwise, validates the specified role exists, assigns it to the user, and updates RolesChangedOn for non-guest users.
700AssignVmiLocationsIf VmiLocationIds parameter is null, bypasses handler. Unassigns all existing VMI location customers from the user. If VmiLocationIds is not empty, retrieves the VmiLocations and assigns their associated customers to the user. Invalidates ETag caches for updated customers.
800SetUpdateVmiUserResultCopies UserId, Role, VmiLocationIds, and RemoveVmiPermissions from the parameter to the result for the response.