| POST | /location/background |
|---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using WebService.ServiceModel;
using CommonService.Api.Models.Base;
namespace CommonService.Api.Models.Base
{
public partial class ApiServiceResponse
: IServiceResponse
{
public virtual string Description { get; set; }
public virtual string Heading { get; set; }
public virtual bool WasSuccessful { get; set; }
public virtual Object ModelState { get; set; }
}
}
namespace WebService.ServiceModel
{
public partial class ActivityData
{
public virtual string type { get; set; }
public virtual int confidence { get; set; }
}
public partial class BackgroundLocationReceived
: IHasApiKey
{
public virtual string ApiKey { get; set; }
public virtual LocationData location { get; set; }
}
public partial class BatteryData
{
public virtual double level { get; set; }
public virtual bool is_charging { get; set; }
}
public partial class CoordsData
{
public virtual double speed { get; set; }
public virtual double longitude { get; set; }
public virtual double latitude { get; set; }
public virtual double accuracy { get; set; }
public virtual double altitude { get; set; }
public virtual double heading { get; set; }
}
public partial class ExtrasData
{
public virtual int systemUserId { get; set; }
public virtual Guid deviceId { get; set; }
}
public partial class LocationData
{
public virtual CoordsData coords { get; set; }
public virtual ExtrasData extras { get; set; }
public virtual bool is_moving { get; set; }
public virtual double odometer { get; set; }
public virtual string uuid { get; set; }
public virtual ActivityData activity { get; set; }
public virtual BatteryData battery { get; set; }
public virtual DateTime timestamp { get; set; }
}
}
C# BackgroundLocationReceived DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=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: {}
}