Cochrane+ App API

<back to all web services

BackgroundLocationReceived

The following routes are available for this service:
POST/location/background
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports WebService.ServiceModel
Imports CommonService.Api.Models.Base

Namespace Global

    Namespace CommonService.Api.Models.Base

        Public Partial Class ApiServiceResponse
            Implements IServiceResponse
            Public Overridable Property Description As String
            Public Overridable Property Heading As String
            Public Overridable Property WasSuccessful As Boolean
            Public Overridable Property ModelState As Object
        End Class
    End Namespace

    Namespace WebService.ServiceModel

        Public Partial Class ActivityData
            Public Overridable Property type As String
            Public Overridable Property confidence As Integer
        End Class

        Public Partial Class BackgroundLocationReceived
            Implements IHasApiKey
            Public Overridable Property ApiKey As String
            Public Overridable Property location As LocationData
        End Class

        Public Partial Class BatteryData
            Public Overridable Property level As Double
            Public Overridable Property is_charging As Boolean
        End Class

        Public Partial Class CoordsData
            Public Overridable Property speed As Double
            Public Overridable Property longitude As Double
            Public Overridable Property latitude As Double
            Public Overridable Property accuracy As Double
            Public Overridable Property altitude As Double
            Public Overridable Property heading As Double
        End Class

        Public Partial Class ExtrasData
            Public Overridable Property systemUserId As Integer
            Public Overridable Property deviceId As Guid
        End Class

        Public Partial Class LocationData
            Public Overridable Property coords As CoordsData
            Public Overridable Property extras As ExtrasData
            Public Overridable Property is_moving As Boolean
            Public Overridable Property odometer As Double
            Public Overridable Property uuid As String
            Public Overridable Property activity As ActivityData
            Public Overridable Property battery As BatteryData
            Public Overridable Property timestamp As Date
        End Class
    End Namespace
End Namespace

VB.NET 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: {}
}