Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /articles | Add new article | Add article to the company for the currently logged in user |
---|
import 'package:servicestack/servicestack.dart';
class ArticleResponse implements IConvertible
{
String? CompanyId;
int? Id;
String? Name;
int? ArticleTypeId;
String? Description;
String? ImageUrl;
bool? Active;
int? Amount;
double? Price;
String? CurrencyId;
DateTime? UpdatedDate;
DateTime? CreatedDate;
DateTime? ModifiedDate;
ArticleResponse({this.CompanyId,this.Id,this.Name,this.ArticleTypeId,this.Description,this.ImageUrl,this.Active,this.Amount,this.Price,this.CurrencyId,this.UpdatedDate,this.CreatedDate,this.ModifiedDate});
ArticleResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
Name = json['Name'];
ArticleTypeId = json['ArticleTypeId'];
Description = json['Description'];
ImageUrl = json['ImageUrl'];
Active = json['Active'];
Amount = json['Amount'];
Price = JsonConverters.toDouble(json['Price']);
CurrencyId = json['CurrencyId'];
UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id,
'Name': Name,
'ArticleTypeId': ArticleTypeId,
'Description': Description,
'ImageUrl': ImageUrl,
'Active': Active,
'Amount': Amount,
'Price': Price,
'CurrencyId': CurrencyId,
'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!)
};
getTypeName() => "ArticleResponse";
TypeContext? context = _ctx;
}
class CreateArticle implements IConvertible
{
/**
*
*/
// @ApiMember(Description="")
String? CompanyId;
/**
*
*/
// @ApiMember(Description="")
String? Name;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
int? ArticleTypeId;
/**
*
*/
// @ApiMember(Description="")
String? Description;
/**
*
*/
// @ApiMember(Description="")
String? ImageUrl;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
bool? Active;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
int? Amount;
/**
* .
*/
// @ApiMember(Description=".", IsRequired=true)
double? Price;
/**
* The payment currency id
*/
// @ApiMember(Description="The payment currency id", IsRequired=true)
String? CurrencyId;
CreateArticle({this.CompanyId,this.Name,this.ArticleTypeId,this.Description,this.ImageUrl,this.Active,this.Amount,this.Price,this.CurrencyId});
CreateArticle.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Name = json['Name'];
ArticleTypeId = json['ArticleTypeId'];
Description = json['Description'];
ImageUrl = json['ImageUrl'];
Active = json['Active'];
Amount = json['Amount'];
Price = JsonConverters.toDouble(json['Price']);
CurrencyId = json['CurrencyId'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Name': Name,
'ArticleTypeId': ArticleTypeId,
'Description': Description,
'ImageUrl': ImageUrl,
'Active': Active,
'Amount': Amount,
'Price': Price,
'CurrencyId': CurrencyId
};
getTypeName() => "CreateArticle";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'ArticleResponse': TypeInfo(TypeOf.Class, create:() => ArticleResponse()),
'CreateArticle': TypeInfo(TypeOf.Class, create:() => CreateArticle()),
});
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /articles HTTP/1.1
Host: testapi.bokamera.se
Accept: application/json
Content-Type: application/json
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Id":0,"Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00"}