Field Squared API Services

<back to all web services

DriveTime

The following routes are available for this service:
GET/{Workspace}/DriveTime
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 DriveTime implements IConvertible
{
    String? Workspace;
    Location? StartLoc;
    Location? EndLoc;
    double? Duration;
    double? Distance;
    String? Error;
    String? UserId;
    String? EndScheduleId;
    int? TimeBetweenSchedules;

    DriveTime({this.Workspace,this.StartLoc,this.EndLoc,this.Duration,this.Distance,this.Error,this.UserId,this.EndScheduleId,this.TimeBetweenSchedules});
    DriveTime.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        StartLoc = JsonConverters.fromJson(json['StartLoc'],'Location',context!);
        EndLoc = JsonConverters.fromJson(json['EndLoc'],'Location',context!);
        Duration = JsonConverters.toDouble(json['Duration']);
        Distance = JsonConverters.toDouble(json['Distance']);
        Error = json['Error'];
        UserId = json['UserId'];
        EndScheduleId = json['EndScheduleId'];
        TimeBetweenSchedules = json['TimeBetweenSchedules'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'StartLoc': JsonConverters.toJson(StartLoc,'Location',context!),
        'EndLoc': JsonConverters.toJson(EndLoc,'Location',context!),
        'Duration': Duration,
        'Distance': Distance,
        'Error': Error,
        'UserId': UserId,
        'EndScheduleId': EndScheduleId,
        'TimeBetweenSchedules': TimeBetweenSchedules
    };

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

TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
    'Location': TypeInfo(TypeOf.Class, create:() => Location()),
    'DriveTime': TypeInfo(TypeOf.Class, create:() => DriveTime()),
});

Dart DriveTime 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}/DriveTime HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/json