Field Squared API Services

<back to all web services

Authentication

The following routes are available for this service:
POST/Authentication
import 'package:servicestack/servicestack.dart';

class Authentication implements IConvertible
{
    String? Email;
    String? Password;
    String? Code;
    dynamic? SubscriptionObject;
    String? DeviceId;

    Authentication({this.Email,this.Password,this.Code,this.SubscriptionObject,this.DeviceId});
    Authentication.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Email = json['Email'];
        Password = json['Password'];
        Code = json['Code'];
        SubscriptionObject = JsonConverters.fromJson(json['SubscriptionObject'],'dynamic',context!);
        DeviceId = json['DeviceId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Email': Email,
        'Password': Password,
        'Code': Code,
        'SubscriptionObject': JsonConverters.toJson(SubscriptionObject,'dynamic',context!),
        'DeviceId': DeviceId
    };

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

class AuthenticationResponse implements IConvertible
{
    String? AuthToken;
    String? Workspace;
    String? UserId;
    List<String>? Teams;
    int? MobileTaskRangePast;
    int? MobileTaskRangeFuture;
    String? RetainCustomerDatabase;
    String? RetainAssetDatabase;
    String? UserType;

    AuthenticationResponse({this.AuthToken,this.Workspace,this.UserId,this.Teams,this.MobileTaskRangePast,this.MobileTaskRangeFuture,this.RetainCustomerDatabase,this.RetainAssetDatabase,this.UserType});
    AuthenticationResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        AuthToken = json['AuthToken'];
        Workspace = json['Workspace'];
        UserId = json['UserId'];
        Teams = JsonConverters.fromJson(json['Teams'],'List<String>',context!);
        MobileTaskRangePast = json['MobileTaskRangePast'];
        MobileTaskRangeFuture = json['MobileTaskRangeFuture'];
        RetainCustomerDatabase = json['RetainCustomerDatabase'];
        RetainAssetDatabase = json['RetainAssetDatabase'];
        UserType = json['UserType'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'AuthToken': AuthToken,
        'Workspace': Workspace,
        'UserId': UserId,
        'Teams': JsonConverters.toJson(Teams,'List<String>',context!),
        'MobileTaskRangePast': MobileTaskRangePast,
        'MobileTaskRangeFuture': MobileTaskRangeFuture,
        'RetainCustomerDatabase': RetainCustomerDatabase,
        'RetainAssetDatabase': RetainAssetDatabase,
        'UserType': UserType
    };

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

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

Dart Authentication 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.

POST /Authentication HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Email":"String","Password":"String","Code":"String","SubscriptionObject":{},"DeviceId":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"AuthToken":"String","Workspace":"String","UserId":"String","Teams":["String"],"MobileTaskRangePast":0,"MobileTaskRangeFuture":0,"RetainCustomerDatabase":"String","RetainAssetDatabase":"String","UserType":"String"}