Field Squared API Services

<back to all web services

Route

Contains the data for a route within the system.

The following routes are available for this service:
GET,POST,DELETE/{Workspace}/Route/{ObjectId}
GET/{Workspace}/Route/{UserId}/{Date}
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;
}

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>[]),
});

Dart Route DTOs

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

HTTP + XML

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

POST /{Workspace}/Route/{ObjectId} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<Route xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.MapRoute">
  <AssignedWorkspace>String</AssignedWorkspace>
  <BasedOn>String</BasedOn>
  <Created>String</Created>
  <Date>String</Date>
  <EndTime>String</EndTime>
  <LastUpdated>String</LastUpdated>
  <Name>String</Name>
  <Nodes>
    <RouteNode>
      <Ancestors xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">
        <d4p1:string>String</d4p1:string>
      </Ancestors>
      <Class xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Class>
      <ObjectId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</ObjectId>
      <Type xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Type>
      <VersionId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</VersionId>
      <Location xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:x>0</d4p1:x>
        <d4p1:y>0</d4p1:y>
      </Location>
      <Name>String</Name>
      <Schedule xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Schedules">
        <d4p1:BasedOn>String</d4p1:BasedOn>
        <d4p1:Data xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringanyType>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value />
          </d5p1:KeyValueOfstringanyType>
        </d4p1:Data>
        <d4p1:End>String</d4p1:End>
        <d4p1:ObjectId>String</d4p1:ObjectId>
        <d4p1:Start>String</d4p1:Start>
        <d4p1:Teams xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:string>String</d5p1:string>
        </d4p1:Teams>
        <d4p1:TimeZone>String</d4p1:TimeZone>
        <d4p1:Users xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:string>String</d5p1:string>
        </d4p1:Users>
        <d4p1:VersionId>String</d4p1:VersionId>
        <d4p1:Workspace>String</d4p1:Workspace>
      </Schedule>
      <StopTime>0</StopTime>
    </RouteNode>
  </Nodes>
  <ObjectId>String</ObjectId>
  <Segments>
    <RouteSegment>
      <Distance>0</Distance>
      <DrivingDirections xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </DrivingDirections>
      <End>String</End>
      <EndNode>
        <Ancestors xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">
          <d5p1:string>String</d5p1:string>
        </Ancestors>
        <Class xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Class>
        <ObjectId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</ObjectId>
        <Type xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Type>
        <VersionId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</VersionId>
        <Location xmlns:d5p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
          <d5p1:x>0</d5p1:x>
          <d5p1:y>0</d5p1:y>
        </Location>
        <Name>String</Name>
        <Schedule xmlns:d5p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Schedules">
          <d5p1:BasedOn>String</d5p1:BasedOn>
          <d5p1:Data xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:KeyValueOfstringanyType>
              <d6p1:Key>String</d6p1:Key>
              <d6p1:Value />
            </d6p1:KeyValueOfstringanyType>
          </d5p1:Data>
          <d5p1:End>String</d5p1:End>
          <d5p1:ObjectId>String</d5p1:ObjectId>
          <d5p1:Start>String</d5p1:Start>
          <d5p1:Teams xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:string>String</d6p1:string>
          </d5p1:Teams>
          <d5p1:TimeZone>String</d5p1:TimeZone>
          <d5p1:Users xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:string>String</d6p1:string>
          </d5p1:Users>
          <d5p1:VersionId>String</d5p1:VersionId>
          <d5p1:Workspace>String</d5p1:Workspace>
        </Schedule>
        <StopTime>0</StopTime>
      </EndNode>
      <Geometry xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:Location>
          <d4p1:x>0</d4p1:x>
          <d4p1:y>0</d4p1:y>
        </d4p1:Location>
      </Geometry>
      <Start>String</Start>
      <Time>0</Time>
    </RouteSegment>
  </Segments>
  <StartTime>String</StartTime>
  <Type>String</Type>
  <UserId>String</UserId>
  <VersionId>String</VersionId>
  <Workspace>String</Workspace>
</Route>