# IRPCVault.GetUsersAndUserGroupsOrDelta

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Vault information](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserGroupsOrDelta/

Badges: `Vault API / core` `write` `session or assertion` `returns metadata structure version`

Gets users and normal user groups as JSON, or only the changes since a version the caller
already has.

- **Service:** [Vault information](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/index.md) `MFiles.IRPCVault`
- **gRPC method:** `/MFiles.IRPCVault/GetUsersAndUserGroupsOrDelta`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-users-and-user-groups-or-delta`
- **Request:** [`GetUsersAndUserGroupsOrDeltaRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserGroupsOrDelta/index.md#request)
- **Response:** [`GetUsersAndUserGroupsOrDeltaResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserGroupsOrDelta/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** write
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

Used by M-Files clients to keep a local copy of the user lists; applications usually call
[GetUsersAndUserContainers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserContainers/index.md) instead.

Send 0 for both versions to get everything. Later, send the `current_..._version_on_server`
values you received with `allow_receiving_delta` true: if nothing changed, the JSON is an empty
delta (`{"isDelta":true,"removedUsers":[],"users":[]}` for users). `users` and `groups` are
NUL-terminated UTF-8 JSON objects, zlib-compressed unless their length field is 4294967295.

<a id="request"></a>

## Request: GetUsersAndUserGroupsOrDeltaRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `callers_current_users_version` | `int64` | The users version from your previous call, or 0 to get all users. |
| `callers_current_user_groups_version` | `int64` | The user groups version from your previous call, or 0 to get all groups. |
| `allow_receiving_delta` | `bool` | True to accept only the changes since the versions given. |

<a id="response"></a>

## Response: GetUsersAndUserGroupsOrDeltaResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `current_users_version_on_server` | `int64` | The current users version. Send it in the next call. |
| `current_user_groups_version_on_server` | `int64` | The current user groups version. Send it in the next call. |
| `users` | `bytes` | NUL-terminated JSON object (`isDelta`, `removedUsers`, `users`), zlib-compressed unless `uncompressed_users_length` is 4294967295. |
| `uncompressed_users_length` | `uint32` | Size of the decompressed `users`, or 4294967295 if not compressed. |
| `groups` | `bytes` | NUL-terminated JSON object with the groups or their changes, zlib-compressed unless `uncompressed_groups_length` is 4294967295. |
| `uncompressed_groups_length` | `uint32` | Size of the decompressed `groups`, or 4294967295 if not compressed. |

<a id="related"></a>

## Related methods

- [GetUsersAndUserContainers](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserContainers/index.md): Gets all users and all user groups of the vault.
- [GetUsersAndUserGroups](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVault/GetUsersAndUserGroups/index.md): Gets all users and normal user groups of the vault as JSON.
