Field Squared API Services

<back to all web services

RouteList

The following routes are available for this service:
GET/{Workspace}/RouteList
GET/{Workspace}/RouteList/Count
import 'package:servicestack/servicestack.dart';

class Location implements IConvertible
{
    double? y;
    double? x;

    Location({this.y,this.x});
    Location.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        y = JsonConverters.toDouble(json['y']);
        x = JsonConverters.toDouble(json['x']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'y': y,
        'x': x
    };

    getTypeName() => "Location";
    TypeContext? context = _ctx;
}

class ClassedItem implements IConvertible
{
    String? ObjectId;
    String? Class;
    String? VersionId;
    List<String>? Ancestors;
    String? Type;

    ClassedItem({this.ObjectId,this.Class,this.VersionId,this.Ancestors,this.Type});
    ClassedItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ObjectId = json['ObjectId'];
        Class = json['Class'];
        VersionId = json['VersionId'];
        Ancestors = JsonConverters.fromJson(json['Ancestors'],'List<String>',context!);
        Type = json['Type'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ObjectId': ObjectId,
        'Class': Class,
        'VersionId': VersionId,
        'Ancestors': JsonConverters.toJson(Ancestors,'List<String>',context!),
        'Type': Type
    };

    getTypeName() => "ClassedItem";
    TypeContext? context = _ctx;
}

class Schedule implements IConvertible
{
    String? Workspace;
    String? ObjectId;
    String? VersionId;
    String? BasedOn;
    String? Start;
    String? End;
    String? TimeZone;
    List<String>? Users;
    List<String>? Teams;
    Map<String,dynamic?>? Data;

    Schedule({this.Workspace,this.ObjectId,this.VersionId,this.BasedOn,this.Start,this.End,this.TimeZone,this.Users,this.Teams,this.Data});
    Schedule.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        ObjectId = json['ObjectId'];
        VersionId = json['VersionId'];
        BasedOn = json['BasedOn'];
        Start = json['Start'];
        End = json['End'];
        TimeZone = json['TimeZone'];
        Users = JsonConverters.fromJson(json['Users'],'List<String>',context!);
        Teams = JsonConverters.fromJson(json['Teams'],'List<String>',context!);
        Data = JsonConverters.fromJson(json['Data'],'Map<String,dynamic?>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'ObjectId': ObjectId,
        'VersionId': VersionId,
        'BasedOn': BasedOn,
        'Start': Start,
        'End': End,
        'TimeZone': TimeZone,
        'Users': JsonConverters.toJson(Users,'List<String>',context!),
        'Teams': JsonConverters.toJson(Teams,'List<String>',context!),
        'Data': JsonConverters.toJson(Data,'Map<String,dynamic?>',context!)
    };

    getTypeName() => "Schedule";
    TypeContext? context = _ctx;
}

class RouteNode extends ClassedItem implements IConvertible
{
    Location? Location;
    int? StopTime;
    Schedule? Schedule;
    String? Name;

    RouteNode({this.Location,this.StopTime,this.Schedule,this.Name});
    RouteNode.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Location = JsonConverters.fromJson(json['Location'],'Location',context!);
        StopTime = json['StopTime'];
        Schedule = JsonConverters.fromJson(json['Schedule'],'Schedule',context!);
        Name = json['Name'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Location': JsonConverters.toJson(Location,'Location',context!),
        'StopTime': StopTime,
        'Schedule': JsonConverters.toJson(Schedule,'Schedule',context!),
        'Name': Name
    });

    getTypeName() => "RouteNode";
    TypeContext? context = _ctx;
}

class RouteSegment implements IConvertible
{
    int? Time;
    double? Distance;
    String? Start;
    String? End;
    List<Location>? Geometry;
    List<String>? DrivingDirections;
    RouteNode? EndNode;

    RouteSegment({this.Time,this.Distance,this.Start,this.End,this.Geometry,this.DrivingDirections,this.EndNode});
    RouteSegment.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Time = json['Time'];
        Distance = JsonConverters.toDouble(json['Distance']);
        Start = json['Start'];
        End = json['End'];
        Geometry = JsonConverters.fromJson(json['Geometry'],'List<Location>',context!);
        DrivingDirections = JsonConverters.fromJson(json['DrivingDirections'],'List<String>',context!);
        EndNode = JsonConverters.fromJson(json['EndNode'],'RouteNode',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Time': Time,
        'Distance': Distance,
        'Start': Start,
        'End': End,
        'Geometry': JsonConverters.toJson(Geometry,'List<Location>',context!),
        'DrivingDirections': JsonConverters.toJson(DrivingDirections,'List<String>',context!),
        'EndNode': JsonConverters.toJson(EndNode,'RouteNode',context!)
    };

    getTypeName() => "RouteSegment";
    TypeContext? context = _ctx;
}

/**
* Contains the data for a route within the system.
*/
class Route implements IConvertible
{
    String? Workspace;
    String? AssignedWorkspace;
    String? ObjectId;
    String? VersionId;
    String? BasedOn;
    String? Created;
    String? LastUpdated;
    String? Date;
    String? StartTime;
    String? EndTime;
    String? UserId;
    String? Name;
    String? Type;
    List<RouteSegment>? Segments;
    int? TotalTime;
    double? TotalDistance;
    List<RouteNode>? Nodes;

    Route({this.Workspace,this.AssignedWorkspace,this.ObjectId,this.VersionId,this.BasedOn,this.Created,this.LastUpdated,this.Date,this.StartTime,this.EndTime,this.UserId,this.Name,this.Type,this.Segments,this.TotalTime,this.TotalDistance,this.Nodes});
    Route.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        AssignedWorkspace = json['AssignedWorkspace'];
        ObjectId = json['ObjectId'];
        VersionId = json['VersionId'];
        BasedOn = json['BasedOn'];
        Created = json['Created'];
        LastUpdated = json['LastUpdated'];
        Date = json['Date'];
        StartTime = json['StartTime'];
        EndTime = json['EndTime'];
        UserId = json['UserId'];
        Name = json['Name'];
        Type = json['Type'];
        Segments = JsonConverters.fromJson(json['Segments'],'List<RouteSegment>',context!);
        TotalTime = json['TotalTime'];
        TotalDistance = JsonConverters.toDouble(json['TotalDistance']);
        Nodes = JsonConverters.fromJson(json['Nodes'],'List<RouteNode>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'AssignedWorkspace': AssignedWorkspace,
        'ObjectId': ObjectId,
        'VersionId': VersionId,
        'BasedOn': BasedOn,
        'Created': Created,
        'LastUpdated': LastUpdated,
        'Date': Date,
        'StartTime': StartTime,
        'EndTime': EndTime,
        'UserId': UserId,
        'Name': Name,
        'Type': Type,
        'Segments': JsonConverters.toJson(Segments,'List<RouteSegment>',context!),
        'TotalTime': TotalTime,
        'TotalDistance': TotalDistance,
        'Nodes': JsonConverters.toJson(Nodes,'List<RouteNode>',context!)
    };

    getTypeName() => "Route";
    TypeContext? context = _ctx;
}

class RouteList implements IConvertible
{
    String? Workspace;
    String? DateGenerated;
    List<Route>? Routes;
    int? RecordsAvailable;

    RouteList({this.Workspace,this.DateGenerated,this.Routes,this.RecordsAvailable});
    RouteList.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        DateGenerated = json['DateGenerated'];
        Routes = JsonConverters.fromJson(json['Routes'],'List<Route>',context!);
        RecordsAvailable = json['RecordsAvailable'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'DateGenerated': DateGenerated,
        'Routes': JsonConverters.toJson(Routes,'List<Route>',context!),
        'RecordsAvailable': RecordsAvailable
    };

    getTypeName() => "RouteList";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
    'Location': TypeInfo(TypeOf.Class, create:() => Location()),
    'ClassedItem': TypeInfo(TypeOf.Class, create:() => ClassedItem()),
    'Schedule': TypeInfo(TypeOf.Class, create:() => Schedule()),
    'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
    'RouteNode': TypeInfo(TypeOf.Class, create:() => RouteNode()),
    'RouteSegment': TypeInfo(TypeOf.Class, create:() => RouteSegment()),
    'List<Location>': TypeInfo(TypeOf.Class, create:() => <Location>[]),
    'Route': TypeInfo(TypeOf.Class, create:() => Route()),
    'List<RouteSegment>': TypeInfo(TypeOf.Class, create:() => <RouteSegment>[]),
    'List<RouteNode>': TypeInfo(TypeOf.Class, create:() => <RouteNode>[]),
    'RouteList': TypeInfo(TypeOf.Class, create:() => RouteList()),
    'List<Route>': TypeInfo(TypeOf.Class, create:() => <Route>[]),
});

Dart RouteList DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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: application/json