@microsoft/sp-http package

Base communication layer for the SharePoint Framework

Classes

AadHttpClient

AadHttpClient is used to perform REST calls against an Azure AD Application.

AadHttpClientConfiguration

Configuration for HttpClient.

AadHttpClientFactory

Returns a preinitialized version of the AadHttpClient for a given resource url. For more information: https://learn.microsoft.com/sharepoint/dev/spfx/use-aadhttpclient

AadHttpClientResponse

The Response subclass returned by methods such as AadHttpClient.fetch(). Class that extends HttpClientResponse adding additional functionality specific to the AadHttpClient.

AadTokenProvider

This class allows a developer to obtain OAuth2 tokens from Azure AD.

OAuth2 tokens are used to authenticate the user from the SharePoint page to other services such as PowerBI, Sway, Exchange, Yammer, etc.

AadTokenProviderFactory

Returns a preinitialized version of the AadTokenProviderFactory.

BeforeRedirectEventArgs

Arguments for before redirecting for a full page authentication

DigestCache

IDigestCache is an internal service used by SPHttpClient to maintain a cache of request digests for each SPWeb URL. A request digest is a security token that the SharePoint server requires for for any REST write operation, specified via the "X-RequestDigest" HTTP header. It is obtained by calling the "/_api/contextinfo" REST endpoint, and expires after a server configurable amount of time.

For more information, see the MSDN article "Complete basic operations using SharePoint 2013 REST endpoints"

HttpClient

HttpClient implements a basic set of features for performing REST operations against a generic service.

HttpClientConfiguration

Configuration for HttpClient.

HttpClientResponse

The Response subclass returned by methods such as HttpClient.fetch().

MSGraphClient

MSGraphClient is used to perform REST calls against Microsoft Graph.

MSGraphClientFactory

Returns a preinitialized version of the MSGraphClient. For more information: https://learn.microsoft.com/sharepoint/dev/spfx/use-msgraph

MSGraphClientV3

MSGraphClient is used to perform REST calls against Microsoft Graph.

ODataVersion

Represents supported version of the "OData-Version" header, which is part of the Open Data Protocol standard.

SPHttpClient

SPHttpClient is used to perform REST calls against SharePoint. It adds default headers, manages the digest needed for writes, and collects telemetry that helps the service to monitor the performance of an application.

SPHttpClientBatch

The SPHttpClientBatch class accumulates a number of REST service calls and transmits them as a single ODATA batch. This protocol is documented here: http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html

The usage is to call SPHttpClientBatch.fetch() to queue each individual request, and then call SPHttpClientBatch.execute() to execute the batch operation. The execute() method returns a promise that resolves when the real REST call has completed. Each call to fetch() also returns a promise that will resolve with an SPHttpClientResponse object for that particular request.

SPHttpClientBatchConfiguration

Configuration for SPHttpClientBatch.

SPHttpClientCommonConfiguration

Common base class for SPHttpClientConfiguration and SPHttpClientBatchConfiguration.

SPHttpClientConfiguration

Configuration for SPHttpClient.

SPHttpClientResponse

The Response subclass returned by methods such as SPHttpClient.fetch().

TokenAcquisitionEventArgs

Arguments for a token acquisition failure event.

Interfaces

GraphRequest

Typings for the GraphRequest Object For more information: https://github.com/microsoftgraph/msgraph-sdk-javascript

IAadHttpClientConfiguration

Flags interface for HttpClientConfiguration.

IAadHttpClientConfigurations

Standard configurations for AadHttpClient.

IAadHttpClientOptions

Interface for overriding the default behavior of AadHttpClient.

IAadTokenProvider

This class allows a developer to obtain OAuth2 tokens from Azure AD.

OAuth2 tokens are used to authenticate the user from the SharePoint page to other services such as PowerBI, Sway, Exchange, Yammer, etc.

IAadTokenProviderConfiguration

Required strings for constructing an AadTokenProvider.

IBeforeRedirectEventArgs

Represents arguments used before redirecting event.

IDigestCache

IDigestCache is an internal service used by SPHttpClient to maintain a cache of request digests for each SPWeb URL. A request digest is a security token that the SharePoint server requires for for any REST write operation, specified via the "X-RequestDigest" HTTP header. It is obtained by calling the "/_api/contextinfo" REST endpoint, and expires after a server configurable amount of time.

For more information, see the MSDN article "Complete basic operations using SharePoint 2013 REST endpoints"

IHttpClientConfiguration

Flags interface for HttpClientConfiguration.

IHttpClientConfigurations

Standard configurations for HttpClient.

IHttpClientOptions

Options for HttpClient

ISPHttpClientBatchConfiguration

Flags interface for SPHttpClientBatchConfiguration.

ISPHttpClientBatchConfigurations

Standard configurations for SPHttpClient.

ISPHttpClientBatchCreationOptions

This interface is passed to the SPHttpClientBatch constructor. It specifies options that affect the entire batch.

ISPHttpClientBatchOptions

This interface defines the options for an individual REST request that is part of an SPHttpClientBatch. It is based on the WHATWG API standard parameters that are documented here: https://fetch.spec.whatwg.org/

ISPHttpClientCommonConfiguration

Flags interface for SPHttpClientCommonConfiguration

ISPHttpClientConfiguration

Flags interface for SPHttpClientConfiguration.

ISPHttpClientConfigurations

Standard configurations for SPHttpClient.

ISPHttpClientOptions

This interface defines the options for the SPHttpClient operations such as get(), post(), fetch(), etc. It is based on the WHATWG API standard parameters that are documented here: https://fetch.spec.whatwg.org/

ITokenAcquisitionEventArgs

Represents arguments used for raising a token acquisiton failure event.

Enums

SPHttpHeader

Standard HTTP headers used with SPHttpClient