I have published Web API from Visual Studio 2017 in Azure portal and I want to consume those data in SharePoint online.

I have created one SPFx project file from node js and opened in Visual Studio code, Now I want to call the Web API from SharePoint framework.

I am new here please post some link and comments. How is it possible?

2 Answers 2


You can use the AadHttpClient in SPFx. It's well documented here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi

  • i went through above url and found they are using Azure function , I want to consume webapi data not azure function? can you please help to differentiate? whether can we use azure function api in webapi ? and how to use to consume webapi in framework Feb 9, 2019 at 15:03

Use jQuery getscript method for calling external API in SharePoint environment. In your spfx webpart code, install jQuery - npm i jQuery and use the following code snippet to call your external API.

  .done(( script, textStatus )=> {
    console.log( textStatus );
  .fail(( jqxhr, settings, exception )=> {
    console.log("Triggered ajaxError handler.");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.