APIPlugin

The plugin that is provided with the origin, proxy, and prefix to make requests to the portal server.

Interface: IApiPlugin.

Variables

origin

Stores the origin parameter of the DocSpace portal.

Type: string

Example: https://example.com

proxy

Stores the proxy parameter of the DocSpace portal.

Type: string

Example: https://proxy-example

prefix

Stores the prefix parameter of the DocSpace portal to access the server side.

Type: string

Example: "prefix"

Methods and their description

setOrigin

Update the origin parameter of the DocSpace portal.

Parameters:

NameTypeExampleDescription
originstringhttps://example.comDefines the origin parameter of the DocSpace portal.

getOrigin

Get the origin parameter of the DocSpace portal.

setProxy

Update the proxy parameter of the DocSpace portal.

Parameters:

NameTypeExampleDescription
proxystringhttps://proxy-exampleDefines the proxy parameter of the DocSpace portal.

getProxy

Get the proxy parameter of the DocSpace portal.

setPrefix

Update the prefix parameter of the DocSpace portal.

Parameters:

NameTypeExampleDescription
prefixstring"prefix"Defines the prefix parameter of the DocSpace portal.

getPrefix

Get the prefix parameter of the DocSpace portal.

setAPI

Update all the API parameters of the DocSpace portal in one request.

Parameters:

NameTypeExampleDescription
originstringhttps://example.comStores the origin parameter of the DocSpace portal.
proxystringhttps://proxy-exampleStores the proxy parameter of the DocSpace portal.
prefixstring"prefix"Stores the prefix parameter of the DocSpace portal to access the server side.

getAPI

Get all the API parameters of the DocSpace portal in one request. Returns an object with the origin, proxy, and prefix parameters.

Example

import {type IApiPlugin} from "@onlyoffice/docspace-plugin-sdk"

class Plugin implements IApiPlugin {
  origin = ""
  proxy = ""
  prefix = ""

  setOrigin = (origin: string): void => {
    this.origin = origin
  }

  getOrigin = (): string => {
    return this.origin
  }

  setProxy = (proxy: string): void => {
    this.proxy = proxy
  }

  getProxy = (): string => {
    return this.proxy
  }

  setPrefix = (prefix: string): void => {
    this.prefix = prefix
  }

  getPrefix = (): string => {
    return this.prefix
  }

  setAPI = (origin: string, proxy: string, prefix: string): void => {
    this.origin = origin
    this.proxy = proxy
    this.prefix = prefix
  }

  getAPI = (): {origin: string; proxy: string; prefix: string} => {
    return {origin: this.origin, proxy: this.proxy, prefix: this.prefix}
  }
}

Get Help

  • If you have any questions about ONLYOFFICE DocSpace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).