AIM Web Services

<back to all web services

SecurityRequest

Login Service

The following routes are available for this service:
POST/api/Security
POST/api/Security/{token}
import 'package:servicestack/servicestack.dart';

// @DataContract
class BaseRequest implements IConvertible
{
    /**
    * This is your AIM API Key provided by Tri-Tech
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
    String? ApiKey;

    // @DataMember
    // @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
    String? OAuthToken;

    BaseRequest({this.ApiKey,this.OAuthToken});
    BaseRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ApiKey = json['ApiKey'];
        OAuthToken = json['OAuthToken'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ApiKey': ApiKey,
        'OAuthToken': OAuthToken
    };

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

// @DataContract
class BaseResponseResult implements IConvertible
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
    String? StatusCode;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
    String? Login;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
    String? ErrorCode;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
    String? ErrorDisplayText;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
    String? ErrorMessage;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
    String? DomainName;

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
    String? IpAddress;

    BaseResponseResult({this.StatusCode,this.Login,this.ErrorCode,this.ErrorDisplayText,this.ErrorMessage,this.DomainName,this.IpAddress});
    BaseResponseResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        StatusCode = json['StatusCode'];
        Login = json['Login'];
        ErrorCode = json['ErrorCode'];
        ErrorDisplayText = json['ErrorDisplayText'];
        ErrorMessage = json['ErrorMessage'];
        DomainName = json['DomainName'];
        IpAddress = json['IpAddress'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'StatusCode': StatusCode,
        'Login': Login,
        'ErrorCode': ErrorCode,
        'ErrorDisplayText': ErrorDisplayText,
        'ErrorMessage': ErrorMessage,
        'DomainName': DomainName,
        'IpAddress': IpAddress
    };

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

// @DataContract
class BaseResponse implements IConvertible
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
    BaseResponseResult? Status;

    BaseResponse({this.Status});
    BaseResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Status = JsonConverters.fromJson(json['Status'],'BaseResponseResult',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Status': JsonConverters.toJson(Status,'BaseResponseResult',context!)
    };

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

// @DataContract
class UserDetail implements IConvertible
{
    // @DataMember
    String? Firstname;

    // @DataMember
    String? LastName;

    // @DataMember
    String? Email;

    // @DataMember
    String? Type;

    // @DataMember
    String? Location;

    // @DataMember
    String? LocationName;

    // @DataMember
    int? AccountNumber;

    // @DataMember
    String? TaxAuthority;

    // @DataMember
    String? TaxAuthorityName;

    UserDetail({this.Firstname,this.LastName,this.Email,this.Type,this.Location,this.LocationName,this.AccountNumber,this.TaxAuthority,this.TaxAuthorityName});
    UserDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Firstname = json['Firstname'];
        LastName = json['LastName'];
        Email = json['Email'];
        Type = json['Type'];
        Location = json['Location'];
        LocationName = json['LocationName'];
        AccountNumber = json['AccountNumber'];
        TaxAuthority = json['TaxAuthority'];
        TaxAuthorityName = json['TaxAuthorityName'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Firstname': Firstname,
        'LastName': LastName,
        'Email': Email,
        'Type': Type,
        'Location': Location,
        'LocationName': LocationName,
        'AccountNumber': AccountNumber,
        'TaxAuthority': TaxAuthority,
        'TaxAuthorityName': TaxAuthorityName
    };

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

// @DataContract
class AccountDetail implements IConvertible
{
    // @DataMember
    int? Acct;

    // @DataMember
    String? AcctType;

    // @DataMember
    String? Name;

    AccountDetail({this.Acct,this.AcctType,this.Name});
    AccountDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Acct = json['Acct'];
        AcctType = json['AcctType'];
        Name = json['Name'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Acct': Acct,
        'AcctType': AcctType,
        'Name': Name
    };

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

// @DataContract
class SecurityResponse extends BaseResponse implements IConvertible
{
    // @DataMember
    String? Token;

    // @DataMember
    String? OAuthToken;

    // @DataMember
    String? Domain;

    // @DataMember
    bool? IsAdmin;

    // @DataMember
    UserDetail? UserDetails;

    // @DataMember
    List<AccountDetail>? AccountDetails;

    SecurityResponse({this.Token,this.OAuthToken,this.Domain,this.IsAdmin,this.UserDetails,this.AccountDetails});
    SecurityResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Token = json['Token'];
        OAuthToken = json['OAuthToken'];
        Domain = json['Domain'];
        IsAdmin = json['IsAdmin'];
        UserDetails = JsonConverters.fromJson(json['UserDetails'],'UserDetail',context!);
        AccountDetails = JsonConverters.fromJson(json['AccountDetails'],'List<AccountDetail>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Token': Token,
        'OAuthToken': OAuthToken,
        'Domain': Domain,
        'IsAdmin': IsAdmin,
        'UserDetails': JsonConverters.toJson(UserDetails,'UserDetail',context!),
        'AccountDetails': JsonConverters.toJson(AccountDetails,'List<AccountDetail>',context!)
    });

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

/**
* Login Service
*/
// @DataContract
class SecurityRequest extends BaseRequest implements IConvertible
{
    /**
    * Employee ID or Customer Email
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Employee ID or Customer Email", IsRequired=true, Name="Username", ParameterType="query")
    String? Username;

    /**
    * Existing Token
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Existing Token", Name="Token", ParameterType="query")
    String? Token;

    /**
    * Password of Employee or User
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Password of Employee or User", IsRequired=true, Name="Password", ParameterType="query")
    String? Password;

    /**
    * 
    */
    // @DataMember(Name="DeviceID")
    // @ApiMember(DataType="string", Description="", IsRequired=true, Name="DeviceID", ParameterType="query")
    String? DeviceID;

    /**
    * 
    */
    // @DataMember(Name="AppID")
    // @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppID", ParameterType="query")
    String? AppID;

    /**
    * 
    */
    // @DataMember(Name="Acct")
    // @ApiMember(DataType="int", Description="", Name="Acct", ParameterType="query")
    int? Acct;

    /**
    * 
    */
    // @DataMember(Name="DeviceName")
    // @ApiMember(DataType="string", Description="", Name="DeviceName", ParameterType="query")
    String? DeviceName;

    SecurityRequest({this.Username,this.Token,this.Password,this.DeviceID,this.AppID,this.Acct,this.DeviceName});
    SecurityRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Username = json['Username'];
        Token = json['Token'];
        Password = json['Password'];
        DeviceID = json['DeviceId'];
        AppID = json['AppId'];
        Acct = json['Acct'];
        DeviceName = json['DeviceName'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Username': Username,
        'Token': Token,
        'Password': Password,
        'DeviceID': DeviceID,
        'AppID': AppID,
        'Acct': Acct,
        'DeviceName': DeviceName
    });

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

TypeContext _ctx = TypeContext(library: 'active_ewebservice.biz', types: <String, TypeInfo> {
    'BaseRequest': TypeInfo(TypeOf.Class, create:() => BaseRequest()),
    'BaseResponseResult': TypeInfo(TypeOf.Class, create:() => BaseResponseResult()),
    'BaseResponse': TypeInfo(TypeOf.Class, create:() => BaseResponse()),
    'UserDetail': TypeInfo(TypeOf.Class, create:() => UserDetail()),
    'AccountDetail': TypeInfo(TypeOf.Class, create:() => AccountDetail()),
    'SecurityResponse': TypeInfo(TypeOf.Class, create:() => SecurityResponse()),
    'List<AccountDetail>': TypeInfo(TypeOf.Class, create:() => <AccountDetail>[]),
    'SecurityRequest': TypeInfo(TypeOf.Class, create:() => SecurityRequest()),
});

Dart SecurityRequest 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 /api/Security HTTP/1.1 
Host: active-ewebservice.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<SecurityRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <ApiKey>String</ApiKey>
  <OAuthToken>String</OAuthToken>
  <Acct>0</Acct>
  <AppID>String</AppID>
  <DeviceID>String</DeviceID>
  <DeviceName>String</DeviceName>
  <Password>String</Password>
  <Token>String</Token>
  <Username>String</Username>
</SecurityRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<SecurityResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <Status>
    <DomainName>String</DomainName>
    <ErrorCode>String</ErrorCode>
    <ErrorDisplayText>String</ErrorDisplayText>
    <ErrorMessage>String</ErrorMessage>
    <IpAddress>String</IpAddress>
    <Login>String</Login>
    <StatusCode>String</StatusCode>
  </Status>
  <AccountDetails>
    <AccountDetail>
      <Acct>0</Acct>
      <AcctType>String</AcctType>
      <Name>String</Name>
    </AccountDetail>
  </AccountDetails>
  <Domain>String</Domain>
  <IsAdmin>false</IsAdmin>
  <OAuthToken>String</OAuthToken>
  <Token>String</Token>
  <UserDetails>
    <AccountNumber>0</AccountNumber>
    <Email>String</Email>
    <Firstname>String</Firstname>
    <LastName>String</LastName>
    <Location>String</Location>
    <LocationName>String</LocationName>
    <TaxAuthority>String</TaxAuthority>
    <TaxAuthorityName>String</TaxAuthorityName>
    <Type>String</Type>
  </UserDetails>
</SecurityResponse>