Trackunit API

<back to all web services

GetReportKeyHistory

The following routes are available for this service:
GET POST/report/keyhistory
import Foundation
import ServiceStack

// @DataContract
public class GetReportKeyHistory : Codable
{
    // @DataMember
    public var keyId:String

    // @DataMember
    public var from:Date?

    // @DataMember
    public var to:Date?

    required public init(){}
}

// @DataContract
public class GetReportKeyHistoryResponse : Codable
{
    // @DataMember
    public var list:[KeyHistory]

    // @DataMember
    public var responseStatus:ResponseStatus

    required public init(){}
}

// @DataContract
public class KeyHistory : Codable
{
    // @DataMember
    public var unitId:String

    // @DataMember
    public var time:Date

    // @DataMember
    public var location:Location

    // @DataMember
    public var address:Address

    // @DataMember
    public var heading:Int?

    // @DataMember
    public var speed:Double?

    // @DataMember
    public var km:Double?

    // @DataMember
    public var run1:Double?

    // @DataMember
    public var run2:Double?

    // @DataMember
    public var runOdo:Double?

    // @DataMember
    public var temperature1:Double?

    // @DataMember
    public var temperature2:Double?

    // @DataMember
    public var input1:Bool?

    // @DataMember
    public var input2:Bool?

    // @DataMember
    public var output3:Bool?

    // @DataMember
    public var batteryLevel:Double?

    // @DataMember
    public var externalPower:Double?

    required public init(){}
}

// @DataContract
public class Location : Codable
{
    // @DataMember
    public var latitude:Double

    // @DataMember
    public var longitude:Double

    required public init(){}
}

// @DataContract
public class Address : Codable
{
    // @DataMember
    public var country:String

    // @DataMember
    public var zipCode:String

    // @DataMember
    public var city:String

    // @DataMember
    public var streetAddress:String

    required public init(){}
}


Swift GetReportKeyHistory DTOs

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

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /report/keyhistory HTTP/1.1 
Host: api.trackunit.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"keyId":"String","from":"0001-01-01T00:00:00.0000000Z","to":"0001-01-01T00:00:00.0000000Z"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"list":[{"unitId":"String","time":"0001-01-01T00:00:00.0000000Z","location":{"latitude":0,"longitude":0},"address":{"country":"String","zipCode":"String","city":"String","streetAddress":"String"},"heading":0,"speed":0,"km":0,"run1":0,"run2":0,"runOdo":0,"temperature1":0,"temperature2":0,"input1":false,"input2":false,"output3":false,"batteryLevel":0,"externalPower":0}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}