Skip to main content
Copy edited (e.g. ref. <https://en.wikipedia.org/wiki/SharePoint>).
Source Link

calling Calling external API in sharepointSharePoint framework

I am trying to call the dummy API from SPFX, but I am getting an error that, Failed to fetch,

  this.context.httpClient
  .get("http://dummy.restapiexample.com/api/v1/employees", HttpClient.configurations.v1)
  .then((res: HttpClientResponse): Promise<any> => {
    alert("");
    return res.json();
  })
  .then((data: any): void => {
    alert("");
    // processProcess your data here
  }, (err: any): void => {
    // handleHandle error here
  });

Please suggest here..How can I fix this problem?

calling external API in sharepoint framework

I am trying to call dummy API from SPFX, but getting error that Failed to fetch,

  this.context.httpClient
  .get("http://dummy.restapiexample.com/api/v1/employees", HttpClient.configurations.v1)
  .then((res: HttpClientResponse): Promise<any> => {
    alert("");
    return res.json();
  })
  .then((data: any): void => {
    alert("");
    // process your data here
  }, (err: any): void => {
    // handle error here
  });

Please suggest here..

Calling external API in SharePoint framework

I am trying to call the dummy API from SPFX, but I am getting an error, Failed to fetch,

  this.context.httpClient
  .get("http://dummy.restapiexample.com/api/v1/employees", HttpClient.configurations.v1)
  .then((res: HttpClientResponse): Promise<any> => {
    alert("");
    return res.json();
  })
  .then((data: any): void => {
    alert("");
    // Process your data here
  }, (err: any): void => {
    // Handle error here
  });

How can I fix this problem?

Tweeted twitter.com/StackSharePoint/status/1149695055336226817
Became Hot Network Question
edited tags
Link
Gautam Sheth
  • 31k
  • 1
  • 36
  • 62
Source Link
KumarV
  • 2.7k
  • 12
  • 54
  • 99

calling external API in sharepoint framework

I am trying to call dummy API from SPFX, but getting error that Failed to fetch,

  this.context.httpClient
  .get("http://dummy.restapiexample.com/api/v1/employees", HttpClient.configurations.v1)
  .then((res: HttpClientResponse): Promise<any> => {
    alert("");
    return res.json();
  })
  .then((data: any): void => {
    alert("");
    // process your data here
  }, (err: any): void => {
    // handle error here
  });

Please suggest here..