| GET | /{Workspace}/RouteList | ||
|---|---|---|---|
| GET | /{Workspace}/RouteList/Count |
import Foundation
import ServiceStack
public class RouteList : Codable
{
public var workspace:String
public var dateGenerated:String
public var routes:[Route] = []
public var recordsAvailable:Int
required public init(){}
}
/**
* Contains the data for a route within the system.
*/
public class Route : Codable
{
public var workspace:String
public var assignedWorkspace:String
public var objectId:String
public var versionId:String
public var basedOn:String
public var created:String
public var lastUpdated:String
public var date:String
public var startTime:String
public var endTime:String
public var userId:String
public var name:String
public var type:String
public var segments:[RouteSegment] = []
public var totalTime:Int
public var totalDistance:Double
public var nodes:[RouteNode] = []
required public init(){}
}
public class RouteSegment : Codable
{
public var time:Int
public var distance:Double
public var start:String
public var end:String
public var geometry:[Location] = []
public var drivingDirections:[String] = []
public var endNode:RouteNode
required public init(){}
}
public class Location : Codable
{
public var y:Double
public var x:Double
required public init(){}
}
public class RouteNode : ClassedItem
{
public var location:Location
public var stopTime:Int
public var schedule:Schedule
public var name:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case location
case stopTime
case schedule
case name
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
location = try container.decodeIfPresent(Location.self, forKey: .location)
stopTime = try container.decodeIfPresent(Int.self, forKey: .stopTime)
schedule = try container.decodeIfPresent(Schedule.self, forKey: .schedule)
name = try container.decodeIfPresent(String.self, forKey: .name)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if location != nil { try container.encode(location, forKey: .location) }
if stopTime != nil { try container.encode(stopTime, forKey: .stopTime) }
if schedule != nil { try container.encode(schedule, forKey: .schedule) }
if name != nil { try container.encode(name, forKey: .name) }
}
}
public class ClassedItem : Codable
{
public var objectId:String
public var `class`:String
public var versionId:String
public var ancestors:[String] = []
public var type:String
required public init(){}
}
public class Schedule : Codable
{
public var workspace:String
public var objectId:String
public var versionId:String
public var basedOn:String
public var start:String
public var end:String
public var timeZone:String
public var users:[String] = []
public var teams:[String] = []
public var data:[String:Object] = [:]
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /{Workspace}/RouteList HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/csv