Search Results for

    Show / Hide Table of Contents

    Overview

    Introduction

    Using the REST API, the mobile app template will query the data source directly from Casewhere via web trigger.

    !

    Method

    Create HTTP connection

    Navigate to src/app/auth/auth-http.service.ts.
    This file has all the methods you can use to work with REST API.
    i.e GET, POST, PUT, PATCH, etc...
    GET

    get(url: string): any {
    	return this.http
    		.get(url, { headers: this.httpOptionsJson })
    		.pipe (catchError(this.handleHttpErrors));
    }
    

    POST

    post(url: string, request: any): any {
    	return this.http.post(url, request).pipe (catchError(this.handleHttpErrors));
    }
    

    Change API destination

    • Step 1. Create Service, and inject contact.service.ts

    • Step 2. Config environment.API_URL to execute the request

    For example, in getContactById function

    getContactById(id: string): Observable<any> {
    	if (!id || id === '0') {
    		this.contact.next(new Contact());
    	}
    	else {
    		return this.autHttp.get(`${environment.API_URL}/contact?Id=${id}`)
    			.pipe(
    				map((res: any) => {
    					this.contact.next(res);
    					return res;
    				}),
    				catchError((err, cautch) => ContactService.handleError(err))
    			);
    	}
    }
    
    • Step 3. Modify environment.API_URL to change the destination

    Casewhere web triggers

    Navigate to Casewhere Admin > Web Triggers

    Read more about web trigger here

    In This Article
    Back to top Generated by DocFX