# Api-service
Service that implements requests to server with mapping.

### Usage


import service from node_module

```
import {ApiService} from 'epom-ng2-ui-foundation';
```

add **ApiService** to providers[] in your module

## Service public methods
| Method Declaration                                                      | Description |
| ----------------------------------------------------------------------- | ----------- |
| .**get apiUrl**(): string | return value of private _apiUrl, use as apiService.apiUrl  |
| .**set apiUrl**(url: string) | set private _apiUrl, use as apiService.apiUrl = newApiUrl |
| .**exportData**(url: string): Observable<Blob>  | sends a request with responseType: 'blob' on server, returns Observable with Blob object |
| .**request<T>**(url: string \| Request, options: RequestOptionsArgs): Observable<T>  | sends a request with type 'REQUEST' on server, returns Observable with Response object |
| .**getJson<T>**(url: string, options: RequestOptionsArgs): Observable<T> | sends a request with type 'GET', returns Observable with mapped response json |
| .**postJson<T>**(url: string, body, options?: RequestOptionsArgs): Observable<T> | sends a request with type 'POST', returns Observable with mapped response json |
| .**putJson<T>**(url: string, body, options?: RequestOptionsArgs): Observable<T> | sends a request with type 'PUT', returns Observable with mapped response json |
| .**patchJson<T>**(url: string, body, options?: RequestOptionsArgs): Observable<T> | sends a request with type 'PATCH', returns Observable with mapped response json |
| .**deleteJson<T>**(url: string, options: RequestOptionsArgs): Observable<T> | sends a request with type 'DELETE', returns Observable with mapped response json |
| .**getXml<T>**(url: string, options: RequestOptionsArgs): Observable<T> | sends a request with type 'GET', returns Observable with response xml |


Examples:
```javascript
    this.apiService.getJson<Type>('http://someUrl').subscribe((responseJson: Type) =>
  this.somePageData = responseJson
);
```

