Cochrane+ App API

<back to all web services

BackgroundLocationReceived

The following routes are available for this service:
POST/location/background

export class ApiServiceResponse implements IServiceResponse
{
    public description: string;
    public heading: string;
    public wasSuccessful: boolean;
    public modelState: Object;

    public constructor(init?: Partial<ApiServiceResponse>) { (Object as any).assign(this, init); }
}

export class CoordsData
{
    public speed: number;
    public longitude: number;
    public latitude: number;
    public accuracy: number;
    public altitude: number;
    public heading: number;

    public constructor(init?: Partial<CoordsData>) { (Object as any).assign(this, init); }
}

export class ExtrasData
{
    public systemUserId: number;
    public deviceId: string;

    public constructor(init?: Partial<ExtrasData>) { (Object as any).assign(this, init); }
}

export class ActivityData
{
    public type: string;
    public confidence: number;

    public constructor(init?: Partial<ActivityData>) { (Object as any).assign(this, init); }
}

export class BatteryData
{
    public level: number;
    public is_charging: boolean;

    public constructor(init?: Partial<BatteryData>) { (Object as any).assign(this, init); }
}

export class LocationData
{
    public coords: CoordsData;
    public extras: ExtrasData;
    public is_moving: boolean;
    public odometer: number;
    public uuid: string;
    public activity: ActivityData;
    public battery: BatteryData;
    public timestamp: string;

    public constructor(init?: Partial<LocationData>) { (Object as any).assign(this, init); }
}

export class BackgroundLocationReceived implements IHasApiKey
{
    public apiKey: string;
    public location: LocationData;

    public constructor(init?: Partial<BackgroundLocationReceived>) { (Object as any).assign(this, init); }
}

TypeScript BackgroundLocationReceived DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /location/background HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	apiKey: String,
	location: 
	{
		coords: 
		{
			speed: 0,
			longitude: 0,
			latitude: 0,
			accuracy: 0,
			altitude: 0,
			heading: 0
		},
		extras: 
		{
			systemUserId: 0,
			deviceId: 00000000-0000-0000-0000-000000000000
		},
		is_moving: False,
		odometer: 0,
		uuid: String,
		activity: 
		{
			type: String,
			confidence: 0
		},
		battery: 
		{
			level: 0,
			is_charging: False
		},
		timestamp: 0001-01-01
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	description: String,
	heading: String,
	wasSuccessful: False,
	modelState: {}
}