// Uses Observable.forkJoin() to run multiple concurrent http.get() requests.
 // The entire operation will result in an error state if any single request fails.
 getBooksAndMovies() {
     return Observable.forkJoin(
     this.http.get('/api/books'),
     this.http.get('/api/movies')
     );
 }
 getScript(scriptId: number) {
   return this.http.get<Script>(`${InteractiveExplorerConfig.API_URL}/scripts/${scriptId}`);
 }
 // send a PUT request to the API to update a data object
 updateFood(food) {
     let body = JSON.stringify(food);
     return this.http.put('/api/food/' + food.id, body, httpOptions);
 }
 // This get-by-id will 404 when id not found
 getHero(id: number): Observable<Hero> {
   const url = `${this.heroesUrl}/${id}`;
   return this.http.get<Hero>(url).pipe(
     catchError(this.handleError)
   );
 }
 findAll(): Observable<GatewayRoute[]> {
     return this.http.get<GatewayRoute[]>(SERVER_API_URL + 'api/gateway/routes/');
 }
 postNewContact(contactData: Contact): Observable<Contact> {
   return this.http.post<Contact>(`${environment.backend}/api/contact/`, contactData);
 }
Exemple #7
0
 public create(user: User): Observable<User> {
   return this.httpClient.post<User>("/api/users", user, {
     headers: { "Authorization": "Bearer " + localStorage.getItem("access_token") }
   });
 }
Exemple #8
0
 deleteLetters(id) {
   return this._http.delete(`https://test-api.javascript.ru/v1/ssumatokhin/letters/${id}`, { responseType: 'text' });
 }
Exemple #9
0
 getLetter(id) {
   return this._http.get(`https://test-api.javascript.ru/v1/ssumatokhin/letters/${id}`);
 }
 runFunction(parameters: RunScript) {
   return this.http.post<RunResult>(`${InteractiveExplorerConfig.API_URL}/scripts/${parameters.id}`, parameters);
 }