18
Consuming APIs
Retrieving data or communicating with other systems via APIs is a common requirement in web development and, therefore SPFx solutions. In JavaScript in general, any API can be called using the tool-agnostic fetch() API (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) implemented by all modern browsers.
However, most of the time, SPFx components will get data directly from SharePoint (for example, a list or a site using the SharePoint REST API) or the Microsoft 365 ecosystem (for example, Teams, Outlook, and so on using the Microsoft Graph API). Because this data is protected and always retrieved on behalf of the currently logged-in user, these API calls require an additional authentication layer to work. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access