Cochrane+ App API

<back to all web services

BackgroundLocationReceived

The following routes are available for this service:
POST/location/background
"use strict";
export class ApiServiceResponse {
    /** @param {{description?:string,heading?:string,wasSuccessful?:boolean,modelState?:Object}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    description;
    /** @type {string} */
    heading;
    /** @type {boolean} */
    wasSuccessful;
    /** @type {Object} */
    modelState;
}
export class CoordsData {
    /** @param {{speed?:number,longitude?:number,latitude?:number,accuracy?:number,altitude?:number,heading?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    speed;
    /** @type {number} */
    longitude;
    /** @type {number} */
    latitude;
    /** @type {number} */
    accuracy;
    /** @type {number} */
    altitude;
    /** @type {number} */
    heading;
}
export class ExtrasData {
    /** @param {{systemUserId?:number,deviceId?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    systemUserId;
    /** @type {string} */
    deviceId;
}
export class ActivityData {
    /** @param {{type?:string,confidence?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    type;
    /** @type {number} */
    confidence;
}
export class BatteryData {
    /** @param {{level?:number,is_charging?:boolean}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    level;
    /** @type {boolean} */
    is_charging;
}
export class LocationData {
    /** @param {{coords?:CoordsData,extras?:ExtrasData,is_moving?:boolean,odometer?:number,uuid?:string,activity?:ActivityData,battery?:BatteryData,timestamp?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {CoordsData} */
    coords;
    /** @type {ExtrasData} */
    extras;
    /** @type {boolean} */
    is_moving;
    /** @type {number} */
    odometer;
    /** @type {string} */
    uuid;
    /** @type {ActivityData} */
    activity;
    /** @type {BatteryData} */
    battery;
    /** @type {string} */
    timestamp;
}
export class BackgroundLocationReceived {
    /** @param {{apiKey?:string,location?:LocationData}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    apiKey;
    /** @type {LocationData} */
    location;
}

JavaScript BackgroundLocationReceived DTOs

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

HTTP + CSV

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/csv
Content-Type: text/csv
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-01T00:00:00.0000000"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}