# Type alias SupportApiSettings

SupportApiSettings: { apiUrl: string; implementation: ISupportApiBase; legacyServer?: boolean; reconnectInterval?: number; requestInit?: RequestInit; suppressErrorMessages?: boolean; suppressInfoMessages?: boolean; token?: string; webSocketUrl?: string | false }

Settings for configuring the Support API in the viewer.

#### Type declaration

- ##### apiUrl: string

  URL to the Support API service that will be used to enable PDF editing features.

- ##### implementation: ISupportApiBase

  Specifies a custom implementation of the SupportApi for editing functions. When this property is set, the viewer will use the provided custom implementation instead of a separate service. All other properties (apiUrl, webSocketUrl, and token) will be ignored.

  ### Example

      // Example
      var viewer = new DsPdfViewer("#root", {
           supportApi: {
             implementation: new CustomSupportApi()
           }
      });

- ##### `Optional` legacyServer?: boolean

  Set this setting to true if you are using the Web Forms (WEB API 2) version of the SupportApi service. Note, in most cases, you do not need to set this setting, the server type is determined by the viewer automatically.

  ### Example

      const viewer = new DsPdfViewer("#viewer", {
        supportApi: {
          apiUrl: "/api/pdf-viewer",
          webSocketUrl: "/signalr",
          legacyServer: true,
          token: "support-api-demo-net-core-token"
        }
      });

- ##### `Optional` reconnectInterval?: number

  Automatically reconnect to the server at the specified interval in milliseconds. Used by persistent connections.

  ### Default

  5000

- ##### `Optional` requestInit?: RequestInit

  The internal Support API client uses the fetch API to make requests to the server. Use the requestInit setting to configure fetch options (like authorization headers, etc), see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch for details.

  ### Example

      // Include Basic Authentication headers:
      const viewer = new DsPdfViewer("#viewer", {
        supportApi: {
          apiUrl: "192.168.0.1/support-api",
          requestInit: {
            headers: {
              "Authorization": "Basic " + btoa(unescape(encodeURIComponent("USERNAME:PASSWORD"))),
              "CustomHeader": "Custom header value"
            }
          }
        }
      });

- ##### `Optional` suppressErrorMessages?: boolean

  Suppress Support API error messages (e.g. messages about the Support API availability / version mismatch).

  ### Example

      // Suppress both error and informational messages:
      const viewer = new DsPdfViewer("#viewer", {
        supportApi: {
          apiUrl: "http://192.168.0.1/support-api",
          webSocketUrl: false,
          suppressInfoMessages: true,
          suppressErrorMessages: true
        }
      });

- ##### `Optional` suppressInfoMessages?: boolean

  Suppress Support API informational messages (e.g. Support API reconnect messages).

  ### Example

      // Suppress informational messages only:
      const viewer = new DsPdfViewer("#viewer", {
        supportApi: {
          apiUrl: "http://192.168.0.1/support-api",
          webSocketUrl: false,
          suppressInfoMessages: true
        }
      });

- ##### `Optional` token?: string

  Authentication or antiforgery token. In each subsequent SupportApi request, the token is passed in the request for server-side validation. You can use ASP.NET Core Antiforgery to generate and verify security token, see Cross-Site Request Forgery (XSRF/CSRF) attacks in ASP.NET Core for details.

  ### Example

      // Specify antiforgery token on client side:
      const viewer = new DsPdfViewer("#viewer", {
        supportApi: {
          apiUrl: "192.168.0.1/support-api",
          token: "support-api-demo-net-core-token",
          webSocketUrl: false
        }
      });

  ### Example

      // Here is an example of how to validate the token on the server side inside the SupportApi service project:

      // Startup.cs:
      GcPdfViewerController.Settings.VerifyToken += VerifyAuthToken;

      private void VerifyAuthToken(object sender, SupportApi.Models.VerifyTokenEventArgs e)
      {
         string token = e.Token;
         if (token != "support-api-demo-net-core-token")
         {
             e.Reject = true;
         }
      }

- ##### `Optional` webSocketUrl?: string | false

  Optional. SignalR socket URL for persistent connections. Persistent connections are required for collaboration mode. Set this setting to false to disable persistent connections.

  ### Default

  /signalr