Cochrane+ App API

<back to all web services

BackgroundLocationReceived

The following routes are available for this service:
POST/location/background
namespace WebService.ServiceModel

open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    [<AllowNullLiteral>]
    type ApiServiceResponse() = 
        member val Description:String = null with get,set
        member val Heading:String = null with get,set
        member val WasSuccessful:Boolean = new Boolean() with get,set
        member val ModelState:Object = null with get,set

    [<AllowNullLiteral>]
    type CoordsData() = 
        member val speed:Double = new Double() with get,set
        member val longitude:Double = new Double() with get,set
        member val latitude:Double = new Double() with get,set
        member val accuracy:Double = new Double() with get,set
        member val altitude:Double = new Double() with get,set
        member val heading:Double = new Double() with get,set

    [<AllowNullLiteral>]
    type ExtrasData() = 
        member val systemUserId:Int32 = new Int32() with get,set
        member val deviceId:Guid = new Guid() with get,set

    [<AllowNullLiteral>]
    type ActivityData() = 
        member val type:String = null with get,set
        member val confidence:Int32 = new Int32() with get,set

    [<AllowNullLiteral>]
    type BatteryData() = 
        member val level:Double = new Double() with get,set
        member val is_charging:Boolean = new Boolean() with get,set

    [<AllowNullLiteral>]
    type LocationData() = 
        member val coords:CoordsData = null with get,set
        member val extras:ExtrasData = null with get,set
        member val is_moving:Boolean = new Boolean() with get,set
        member val odometer:Double = new Double() with get,set
        member val uuid:String = null with get,set
        member val activity:ActivityData = null with get,set
        member val battery:BatteryData = null with get,set
        member val timestamp:DateTime = new DateTime() with get,set

    [<AllowNullLiteral>]
    type BackgroundLocationReceived() = 
        member val ApiKey:String = null with get,set
        member val location:LocationData = null with get,set

F# 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: {}
}