-1

I have call below API to get list of answers in angular 6 but I'm getting response null.

API: https://api.stackexchange.com/docs/answers#order=desc&sort=activity&filter=default&site=stackoverflow

Do I need to pass any header param ?

Does anyone have any idea on how to call the stack-exchange API in angular 6 ? Please help me if you know.

Luis Rico
  • 625
  • 6
  • 22
Mitul Patel
  • 66
  • 1
  • 1
  • 11

1 Answers1

1

Here's the url that i used https://api.stackexchange.com/2.2/answers?site=stackoverflow&order=desc&sort=activity&filter=default

enter image description here

You can apply these filters via query params

I have also created a stackblitz where you can see the response in the console

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
HariHaran
  • 3,642
  • 2
  • 16
  • 33
  • Hi, I have added my code on below snipped but it not working can you Please help me on same. https://stackblitz.com/edit/angular-9fzet2 – Mitul Patel Jul 23 '19 at 09:27
  • @MitulPatel the URL you used was the docs site. its not the api. Also understand angular. You need to import `httpclient` from your module – HariHaran Jul 23 '19 at 09:35
  • 1
    I made changes as you suggested and I got the desire result. Thank you so much HariHaran – Mitul Patel Jul 23 '19 at 12:23
  • I'm using below link api but it's not working Please let me know if i'm wrong then give me API links https://api.stackexchange.com/docs/questions#order=desc&sort=activity&filter=default&site=stackoverflow – Mitul Patel Jul 23 '19 at 12:38
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/196869/discussion-between-mitul-patel-and-hariharan). – Mitul Patel Jul 23 '19 at 12:40