Making Requests
To make HTTP requests we will use the Http
service. In this example we are creating a SearchService
to interact with the Spotify API.
Here we are making an HTTP GET request which is exposed to us as an observable. You will notice the map
operator utilized in the pipe, after the .get
. The HttpClient
service provides us with the raw response as a string. In order to consume the fetched data we have to convert it to JSON.
In addition to HttpClient.get()
, there are also HttpClient.post()
, HttpClient.put()
, HttpClient.delete()
, etc. They all return observables.
Last updated