> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish And Retrieve Ui Events

> Publish zero or more events, and return any new events since the given event id.

The initial implementation is in-memory only; applies solely to the front-end web server; and anything older than 20 minutes is discarded
NsApiSlow threshold: 5000 ms.



## OpenAPI

````yaml /openapi/agent/openapi-v3-ViewStateAgent.json post /api/v1/Agents/ViewState/PublishAndRetrieveUiEvents
openapi: 3.0.0
info:
  version: v1-Agents
  title: SuperOffice Agent API v1
  description: SuperOffice Agent API - ViewStateAgent
  contact:
    name: SuperOffice DevNet
    url: https://docs.superoffice.com/en/api/index.html
    email: sdk@superoffice.com
servers:
  - url: http://localhost:56350
  - url: https://localhost:56350
security: []
tags: []
externalDocs:
  description: >-
    The SuperOffice DevNet Community has more documentation, examples, and
    discussion forums.
  url: https://community.superoffice.com/en/developer/
paths:
  /api/v1/Agents/ViewState/PublishAndRetrieveUiEvents:
    post:
      tags:
        - ViewState_Agent
      summary: Publish And Retrieve Ui Events
      description: "Publish zero or more events, and return any new events since the given event id.\n\nThe initial implementation is in-memory only; applies solely to the front-end web server; and anything older than 20 minutes is discarded\r\nNsApiSlow threshold: 5000 ms."
      operationId: v1ViewStateAgent_PublishAndRetrieveUiEvents
      parameters:
        - name: $select
          in: query
          description: >-
            Optional comma separated list of properties to include in the
            result. Other fields are then nulled out to reduce payload size:
            "Name,department,category". Default = show all fields.
          required: false
          schema:
            type: string
        - name: Accept-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code.
          required: false
          schema:
            type: string
        - name: SO-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code. Overrides Accept-Language value.
          required: false
          schema:
            type: string
        - name: SO-Culture
          in: header
          description: >-
            Number, date formatting in a specified culture (iso2 language) code.
            Partially overrides SO-Language/Accept-Language value. Ignored if no
            Language set.
          required: false
          schema:
            type: string
        - name: SO-TimeZone
          in: header
          description: >-
            Specify the timezone code that you would like date/time responses
            converted to.
          required: false
          schema:
            type: string
        - name: SO-AppToken
          in: header
          description: >-
            The application token that identifies the partner app. Used when
            calling Online WebAPI from a server.
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          application/xml:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          text/xml:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          application/x-www-form-urlencoded:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          application/json-patch+json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
          application/merge-patch+json:
            schema:
              $ref: >-
                #/components/schemas/SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest
        description: LatestKnownEventId, PublishEvents, Metrics
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
            text/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
            text/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
            application/json-patch+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
            application/merge-patch+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
      security:
        - SuperOffice_Password: []
          SuperId_Authentication: []
components:
  schemas:
    SuperOffice.WebApi.v1.Carriers.ViewStateCarriers.PublishAndRetrieveUiEventsRequest:
      description: >-
        PublishAndRetrieveUiEvents: Publish zero or more events, and return any
        new events since the given event id. The initial implementation is
        in-memory only; applies solely to the front-end web server; and anything
        older than 20 minutes is discarded
      type: object
      properties:
        LatestKnownEventId:
          format: int32
          type: integer
        PublishEvents:
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.UiEvent'
        Metrics:
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.MetricPair'
    SuperOffice.CRM.Services.UiEvent:
      description: "An event that the user interface should know about. The origin may be something that happens in the user interface (in any session), or in the database (for instance, background process)\r\n<para />\r\nCarrier object for UiEvent.\r\nServices for the UiEvent Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IViewStateAgent\">ViewState Agent</see>."
      type: object
      properties:
        EventId:
          format: int32
          description: Id of event, increasing in chronological order, assigned by server
          type: integer
        EventName:
          description: Name of event, for instance 'change' or 'edit'
          type: string
        EntityType:
          description: Name of entity, for instance 'ticket'
          type: string
        EntityKey:
          format: int32
          description: Primary key of entity the event concerns
          type: integer
        AssociateId:
          format: int32
          description: The ID of the associate causing the event
          type: integer
        AssociateName:
          description: The full person name of the associate causing the event
          type: string
        EventDateTime:
          format: date-time
          description: When did the event happen
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.MetricPair:
      description: "Metric, in the form of string->int\r\n<para />\r\nCarrier object for MetricPair."
      type: object
      properties:
        Name:
          description: The name of the metric
          type: string
        Value:
          format: int32
          description: The value of the metric
          type: integer
    SuperOffice.CRM.Security.TableRight:
      description: "Wraps a table right together with an explanatory reason.\r\nCode can indicate why access is restricted."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string
    SuperOffice.CRM.Security.FieldProperty:
      description: >-
        Class holding properties like field length, field type about a field in
        the carrier.
      type: object
      properties:
        FieldRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldRight'
        FieldType:
          type: string
        FieldLength:
          format: int32
          description: ''
          type: integer
    SuperOffice.CRM.Security.FieldRight:
      description: "Wraps the field right together with an explanatory reason.\r\nAlso adds logical operators to the field rights so that they can be easily combined."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string

````

## Related topics

- [Publish And Sync Ui Events](/en/api/reference/restful/agent/viewstate_agent/publish-and-sync-ui-events.md)
- [SuperOffice.WebApi.Data.ViewState PublishAndRetrieveUiEventsRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.ViewState_PublishAndRetrieveUiEventsRequest.md)
- [SuperOffice.WebApi.Agents.IViewStateAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IViewStateAgent.md)
- [SuperOffice.WebApi.Agents.ViewStateAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ViewStateAgent.md)
- [Is Publish Event Active](/en/api/reference/restful/agent/userdefinedfieldinfo_agent/is-publish-event-active.md)
- [SuperOffice.WebApi.Data.UiEvent](/en/api/reference/webapi/SuperOffice.WebApi.Data.UiEvent.md)
