| POST | /company |
|---|
import 'package:servicestack/servicestack.dart';
class Company implements IConvertible
{
String? UniqueId;
DateTime? CreatedDateTime;
int? ClientId;
String? GroupId;
int? CompanyId;
String? ExternalCompanyId;
String? CompanyName;
String? Address1;
String? Address2;
String? City;
String? State;
String? ZipCode;
String? Country;
String? Website;
String? PhoneNumber;
String? Fax;
int? StateId;
int? CountryId;
int? ChapId;
Company({this.UniqueId,this.CreatedDateTime,this.ClientId,this.GroupId,this.CompanyId,this.ExternalCompanyId,this.CompanyName,this.Address1,this.Address2,this.City,this.State,this.ZipCode,this.Country,this.Website,this.PhoneNumber,this.Fax,this.StateId,this.CountryId,this.ChapId});
Company.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
UniqueId = json['UniqueId'];
CreatedDateTime = JsonConverters.fromJson(json['CreatedDateTime'],'DateTime',context!);
ClientId = json['ClientId'];
GroupId = json['GroupId'];
CompanyId = json['CompanyId'];
ExternalCompanyId = json['ExternalCompanyId'];
CompanyName = json['CompanyName'];
Address1 = json['Address1'];
Address2 = json['Address2'];
City = json['City'];
State = json['State'];
ZipCode = json['ZipCode'];
Country = json['Country'];
Website = json['Website'];
PhoneNumber = json['PhoneNumber'];
Fax = json['Fax'];
StateId = json['StateId'];
CountryId = json['CountryId'];
ChapId = json['ChapId'];
return this;
}
Map<String, dynamic> toJson() => {
'UniqueId': UniqueId,
'CreatedDateTime': JsonConverters.toJson(CreatedDateTime,'DateTime',context!),
'ClientId': ClientId,
'GroupId': GroupId,
'CompanyId': CompanyId,
'ExternalCompanyId': ExternalCompanyId,
'CompanyName': CompanyName,
'Address1': Address1,
'Address2': Address2,
'City': City,
'State': State,
'ZipCode': ZipCode,
'Country': Country,
'Website': Website,
'PhoneNumber': PhoneNumber,
'Fax': Fax,
'StateId': StateId,
'CountryId': CountryId,
'ChapId': ChapId
};
getTypeName() => "Company";
TypeContext? context = _ctx;
}
class ReplyBase implements IHaveErrorField, IConvertible
{
int? ErrorCode;
String? ErrorMessage;
bool? IsError;
ReplyBase({this.ErrorCode,this.ErrorMessage,this.IsError});
ReplyBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ErrorCode = json['ErrorCode'];
ErrorMessage = json['ErrorMessage'];
IsError = json['IsError'];
return this;
}
Map<String, dynamic> toJson() => {
'ErrorCode': ErrorCode,
'ErrorMessage': ErrorMessage,
'IsError': IsError
};
getTypeName() => "ReplyBase";
TypeContext? context = _ctx;
}
class CompanyReply extends ReplyBase implements IConvertible
{
String? UniqueId;
int? CompanyId;
CompanyReply({this.UniqueId,this.CompanyId});
CompanyReply.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
UniqueId = json['UniqueId'];
CompanyId = json['CompanyId'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'UniqueId': UniqueId,
'CompanyId': CompanyId
});
getTypeName() => "CompanyReply";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
'Company': TypeInfo(TypeOf.Class, create:() => Company()),
'ReplyBase': TypeInfo(TypeOf.Class, create:() => ReplyBase()),
'CompanyReply': TypeInfo(TypeOf.Class, create:() => CompanyReply()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /company HTTP/1.1
Host: devapi.billhighway.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
UniqueId: String,
CreatedDateTime: 0001-01-01,
ClientId: 0,
GroupId: String,
CompanyId: 0,
ExternalCompanyId: String,
CompanyName: String,
Address1: String,
Address2: String,
City: String,
State: String,
ZipCode: String,
Country: String,
Website: String,
PhoneNumber: String,
Fax: String,
StateId: 0,
CountryId: 0,
ChapId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
UniqueId: String,
CompanyId: 0,
ErrorCode: 0,
ErrorMessage: String,
IsError: False
}