POST | /eaccounting/articles | Create a new article in e-accounting system |
---|
import 'package:servicestack/servicestack.dart';
class BaseArticleDto implements IConvertible
{
String? ArticleId;
double? ArticlePrice;
String? ArticleName;
DateTime? CreatedDate;
BaseArticleDto({this.ArticleId,this.ArticlePrice,this.ArticleName,this.CreatedDate});
BaseArticleDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ArticleId = json['ArticleId'];
ArticlePrice = JsonConverters.toDouble(json['ArticlePrice']);
ArticleName = json['ArticleName'];
CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ArticleId': ArticleId,
'ArticlePrice': ArticlePrice,
'ArticleName': ArticleName,
'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!)
};
getTypeName() => "BaseArticleDto";
TypeContext? context = _ctx;
}
class EAccountingArticleQueryResponse extends BaseArticleDto implements IConvertible
{
String? UnitId;
String? CodingId;
String? VatRate;
String? VatRatePercent;
String? CurrencySign;
EAccountingArticleQueryResponse({this.UnitId,this.CodingId,this.VatRate,this.VatRatePercent,this.CurrencySign});
EAccountingArticleQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
UnitId = json['UnitId'];
CodingId = json['CodingId'];
VatRate = json['VatRate'];
VatRatePercent = json['VatRatePercent'];
CurrencySign = json['CurrencySign'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'UnitId': UnitId,
'CodingId': CodingId,
'VatRate': VatRate,
'VatRatePercent': VatRatePercent,
'CurrencySign': CurrencySign
});
getTypeName() => "EAccountingArticleQueryResponse";
TypeContext? context = _ctx;
}
class CreateEAccountingArticle extends BaseArticleDto implements ICompany, IConvertible
{
int? ServiceId;
String? CompanyId;
CreateEAccountingArticle({this.ServiceId,this.CompanyId});
CreateEAccountingArticle.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
ServiceId = json['ServiceId'];
CompanyId = json['CompanyId'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'ServiceId': ServiceId,
'CompanyId': CompanyId
});
getTypeName() => "CreateEAccountingArticle";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'BaseArticleDto': TypeInfo(TypeOf.Class, create:() => BaseArticleDto()),
'EAccountingArticleQueryResponse': TypeInfo(TypeOf.Class, create:() => EAccountingArticleQueryResponse()),
'CreateEAccountingArticle': TypeInfo(TypeOf.Class, create:() => CreateEAccountingArticle()),
});
Dart CreateEAccountingArticle DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /eaccounting/articles HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<EAccountingDtos.CreateEAccountingArticle xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<ArticleId>00000000-0000-0000-0000-000000000000</ArticleId>
<ArticleName>String</ArticleName>
<ArticlePrice>0</ArticlePrice>
<CreatedDate>0001-01-01T00:00:00</CreatedDate>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<ServiceId>0</ServiceId>
</EAccountingDtos.CreateEAccountingArticle>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <EAccountingDtos.EAccountingArticleQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <ArticleId>00000000-0000-0000-0000-000000000000</ArticleId> <ArticleName>String</ArticleName> <ArticlePrice>0</ArticlePrice> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <CodingId>String</CodingId> <CurrencySign>String</CurrencySign> <UnitId>String</UnitId> <VatRate>String</VatRate> <VatRatePercent>String</VatRatePercent> </EAccountingDtos.EAccountingArticleQueryResponse>