API 참조

FNetwork

이 API 페이지의 본문은 현재 영어로 제공됩니다. 코드 시그니처와 식별자는 언어에 따라 바뀌지 않습니다.

Make HTTP requests through univerAPI.getNetwork(). Register the Network plugin and import its Facade entry before using these methods. The response wraps the body, status, and headers; getSSE returns an observable stream1.

The following example assumes your application serves a JSON list at /api/items:

TypeScript
const network = univerAPI.getNetwork()const response = await network.get<{ id: string }[]>('/api/items')console.log(response.status, response.body)

Access

Access through:

Setup

Register @univerjs/network or a preset that includes it. In plugin mode, import @univerjs/network/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs/network

FNetwork.delete

Send DELETE request to the server.

TypeScript
delete<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url — Required. The requested URL
  • params — Optional. Request options, including query parameters, headers, and response type

Returns

A promise resolving to the HTTP response with a body of type T.

Types: HTTPResponse · Promise · IRequestParams

Package: @univerjs/network · Type definitions

FNetwork.get

Send a GET request to the server.

TypeScript
get<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url — Required. The requested URL.
  • params — Optional. Request options, including query parameters, headers, and response type.

Returns

A promise resolving to the HTTP response with a body of type T.

Types: HTTPResponse · Promise · IRequestParams

Package: @univerjs/network · Type definitions

FNetwork.getSSE

Request for a stream of server-sent events. Instead of a single response, the server sends a stream of responses, Univer wraps the stream in an Observable which you can call subscribe on.

TypeScript
getSSE<T>(method: HTTPRequestMethod, url: string, params?: IPostRequestParams): Observable<HTTPEvent<T>>

Parameters

  • method — Required. HTTP request method
  • url — Required. The requested URL
  • params — Optional. params Request options, including body, query parameters, headers, and response type

Returns

An observable of HTTP events with response data of type T.

Types: HTTPEvent · Observable · HTTPRequestMethod · IPostRequestParams

Package: @univerjs/network · Type definitions

FNetwork.patch

Send PATCH request to the server.

TypeScript
patch<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url — Required. The requested URL
  • params — Optional. Request options, including body, query parameters, headers, and response type

Returns

A promise resolving to the HTTP response with a body of type T.

Types: HTTPResponse · Promise · IPostRequestParams

Package: @univerjs/network · Type definitions

FNetwork.post

Send a POST request to the server.

TypeScript
post<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url — Required. The requested URL.
  • params — Optional. Request options, including body, query parameters, headers, and response type.

Returns

A promise resolving to the HTTP response with a body of type T.

Types: HTTPResponse · Promise · IPostRequestParams

Package: @univerjs/network · Type definitions

FNetwork.put

Send a PUT request to the server.

TypeScript
put<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url — Required. The requested URL
  • params — Optional. Request options, including body, query parameters, headers, and response type

Returns

A promise resolving to the HTTP response with a body of type T.

Types: HTTPResponse · Promise · IPostRequestParams

Package: @univerjs/network · Type definitions

Footnotes

  1. An RxJS Observable can emit multiple values over time, whereas a Promise resolves once. Subscribe to consume the stream and unsubscribe when it is no longer needed; SSE carries server-to-client events over HTTP. ↩

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.