Skip to main content

core.medplumclient.post

Home > @medplum/core > MedplumClient > post

MedplumClient.post() method

Makes an HTTP POST request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as createResource().

Signature:

post(url: URL | string, body: any, contentType?: string, options?: RequestInit): Promise<any>;

Parameters

ParameterTypeDescription
urlURL | stringThe target URL.
bodyanyThe content body. Strings and File objects are passed directly. Other objects are converted to JSON.
contentTypestring(Optional) The content type to be included in the "Content-Type" header.
optionsRequestInit(Optional) Optional fetch options.

Returns:

Promise<any>

Promise to the response content.