# IRPCViews.GetViewsOrDelta

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) > [Views](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/index.md)

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

Badges: `Vault API / standard` `read` `session or assertion` `idempotent` `returns metadata structure version`

Gets the calling user's whole view collection, or only the changes since a version the caller
already has.

- **Service:** [Views](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/index.md) `MFiles.IRPCViews`
- **gRPC method:** `/MFiles.IRPCViews/GetViewsOrDelta`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-views-or-delta`
- **Request:** [`GetViewsOrDeltaRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/GetViewsOrDelta/index.md#request)
- **Response:** [`GetViewsOrDeltaResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/GetViewsOrDelta/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** read
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** yes
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

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

## Remarks

- Requires a vault session. No special vault rights are needed.
- First call with `callers_current_views_version` 0: `views_or_delta.type` is false (a full
  list) and `current_views_version_on_server` is the version to store.
- Later, send the stored version back:
  - nothing changed: the same version comes back with `type` true and empty lists;
  - something changed: `type` true; `views` has the added and changed views, `removed_views` the
    IDs of deleted views, and `invisible_views` the IDs of views the user can no longer see. Then
    store the new version.
- A version newer than the server's (for example from another vault) returns the full list and
  the server's current version.
- Hiding or showing a view with
  [SetViewVisibility](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/SetViewVisibility/index.md) also produces a change.
- When a deleted view had child views, only the parent's ID appears in `removed_views`; remove
  its descendants from your copy too.

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

## Request: GetViewsOrDeltaRequest

> 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_views_version` | `int64` | The `current_views_version_on_server` from the caller's previous response, or 0 to get the full collection. |

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

## Response: GetViewsOrDeltaResponse

> 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_views_version_on_server` | `int64` | The version of the view collection now. Store it and send it next time. |
| `views_or_delta` | [`ViewsOrDeltaEx`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ViewsOrDeltaEx/index.md) | The full collection (`type` false) or the changes (`type` true). See [ViewsOrDeltaEx](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ViewsOrDeltaEx/index.md). |
| `views_or_delta.type` | `bool` | True if this struct represents a delta (i.e. just the occurred changes to views). |
| `views_or_delta.removed_views[]` | repeated `int32` | Removed views. This contains data only when this struct represents a delta. Otherwise it must be an empty array. |
| `views_or_delta.invisible_views[]` | repeated `int32` | Invisible views. This contains data only when this struct represents a delta. Otherwise it must be an empty array. |
| `views_or_delta.views[]` | repeated [`View`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.View/index.md) | Views. This contains inserted or updated views if this struct represents a delta, otherwise it contains just a "normal" array of views. |
| `views_or_delta.views[].id` | `int32` | The ID of the view. |
| `views_or_delta.views[].type` | [`ViewType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ViewType/index.md) | The type of the view. Values: `VIEW_TYPE_SHOW_OBJECTS` (0), `VIEW_TYPE_FILTER_ONLY` (1). |
| `views_or_delta.views[].name` | `string` | The name of the view. |
| `views_or_delta.views[].is_common` | `bool` | Tells if the view is admin-defined (common) or user-defined. |
| `views_or_delta.views[].is_visible` | `bool` | Tells if the view is visible. |
| `views_or_delta.views[].location` | [`ViewLocation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ViewLocation/index.md) | The location of the view. Valid only if bHasParent is true. |
| `views_or_delta.views[].content_definition` | [`SearchDef`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchDef/index.md) | The search definition that contains the view levels and search conditions of the view. |
| `views_or_delta.views[].acl` | [`AccessControlList`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlList/index.md) | Permissions. |
| `views_or_delta.views[].flags_obsolete` | `uint32` | Bit flags that provide additional information on the view. |
| `views_or_delta.views[].options` | [`VIEWFLAGS`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.VIEWFLAGS/index.md) | Bit flags that provide additional information on the view. |
| `views_or_delta.views[].guid` | `string` | GUID for the view. |
| `views_or_delta.views[].view_visualization` | [`ViewVisualization`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ViewVisualization/index.md) | View visualization information. |

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

## Related methods

- [SetViewVisibility](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/SetViewVisibility/index.md): Shows or hides a view in the calling user's view collection.
- [GetViews](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCViews/GetViews/index.md): Gets the calling user's view collection: all views, or the direct child views of one view.
