@microsoft/sp-http package

Base communication layer for the SharePoint Framework

Remarks

This package defines the base communication layer for the SharePoint Framework. For REST calls, it handles authentication, logging, diagnostics, and batching. It also simplifies requests by adding default headers that follow the recommended best practices.

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://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-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.

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"

GraphHttpClient

GraphHttpClient is used to perform REST calls against Microsoft Graph. It adds default headers and collects telemetry that helps the service to monitor the performance of an application. https://developer.microsoft.com/en-us/graph/

GraphHttpClientConfiguration

Configuration for GraphHttpClient.

GraphHttpClientResponse

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

GraphRequest

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

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://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph

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

IAadHttpClientConfiguration

Flags interface for HttpClientConfiguration.

IAadHttpClientConfigurations

Standard configurations for AadHttpClient.

IAadHttpClientOptions

Interface for overriding the default behavior of AadHttpClient.

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"

IGraphHttpClientConfiguration

Flags interface for GraphHttpClientCommonConfiguration

IGraphHttpClientConfigurations

Standard configurations for GraphHttpClient.

IGraphHttpClientOptions

Options for HttpClient

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/

Enums

SPHttpHeader

Standard HTTP headers used with SPHttpClient