Cochrane+ App API

<back to all web services

BackgroundLocationReceived

The following routes are available for this service:
POST/location/background
import java.math.*
import java.util.*
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*


open class BackgroundLocationReceived : IHasApiKey
{
    var apiKey:String? = null
    var location:LocationData? = null
}

open class LocationData
{
    var coords:CoordsData? = null
    var extras:ExtrasData? = null
    var is_moving:Boolean? = null
    var odometer:Double? = null
    var uuid:String? = null
    var activity:ActivityData? = null
    var battery:BatteryData? = null
    var timestamp:Date? = null
}

open class CoordsData
{
    var speed:Double? = null
    var longitude:Double? = null
    var latitude:Double? = null
    var accuracy:Double? = null
    var altitude:Double? = null
    var heading:Double? = null
}

open class ExtrasData
{
    var systemUserId:Int? = null
    var deviceId:UUID? = null
}

open class ActivityData
{
    @SerializedName("type") var Type:String? = null
    var confidence:Int? = null
}

open class BatteryData
{
    var level:Double? = null
    var is_charging:Boolean? = null
}

open class ApiServiceResponse : IServiceResponse
{
    var description:String? = null
    var heading:String? = null
    var wasSuccessful:Boolean? = null
    var modelState:Object? = null
}

Kotlin 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: {}
}