| POST | /customerarticle | Create a new CustomerArticle. | Create a new CustomerArticle directly with price, status, and customer. |
|---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
using BokaMera.API.ServiceModel.Enums;
using BokaMera.API.ServiceModel.Db;
namespace BokaMera.API.ServiceModel.Db
{
public partial class ArticleServiceRelation
: BaseModel
{
[Required]
public virtual Guid CompanyId { get; set; }
public virtual int Id { get; set; }
[Required]
public virtual int ServiceId { get; set; }
[Required]
public virtual int ArticleId { get; set; }
}
public partial class BaseModel
{
}
}
namespace BokaMera.API.ServiceModel.Dtos
{
public partial class ArticleResponse
{
public virtual Guid CompanyId { get; set; }
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual int ArticleTypeId { get; set; }
public virtual string Description { get; set; }
public virtual string ImageUrl { get; set; }
public virtual bool Active { get; set; }
public virtual int Amount { get; set; }
public virtual double Price { get; set; }
public virtual string CurrencyId { get; set; }
public virtual int SortOrder { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual int Duration { get; set; }
public virtual List<ArticleServiceRelation> Services { get; set; } = [];
public virtual List<int> ServiceIds { get; set; } = [];
public virtual string PriceSign { get; set; }
public virtual decimal? VAT { get; set; }
public virtual int ValidDays { get; set; }
public virtual bool SendNotification { get; set; }
public virtual string NotificationEmail { get; set; }
}
[ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
[ValidateRequest("IsAuthenticated")]
public partial class CreateCustomerArticle
: ICompany
{
///<summary>
///The company id, if empty will use the company id for the user you are logged in with.
///</summary>
[ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")]
public virtual Guid? CompanyId { get; set; }
///<summary>
///The article id to base this customer article on
///</summary>
[ApiMember(Description="The article id to base this customer article on", IsRequired=true)]
public virtual int ArticleId { get; set; }
///<summary>
///The customer id to assign the article to
///</summary>
[ApiMember(Description="The customer id to assign the article to", IsRequired=true)]
public virtual Guid CustomerId { get; set; }
///<summary>
///The status of the customer article
///</summary>
[ApiMember(Description="The status of the customer article")]
public virtual CustomerArticleStatusEnum? StatusId { get; set; }
///<summary>
///Optional price override. If not provided, uses the article price.
///</summary>
[ApiMember(Description="Optional price override. If not provided, uses the article price.")]
public virtual decimal? Price { get; set; }
///<summary>
///Optional VAT override. If not provided, uses the article VAT.
///</summary>
[ApiMember(Description="Optional VAT override. If not provided, uses the article VAT.")]
public virtual decimal? VAT { get; set; }
///<summary>
///Optional currency override. If not provided, uses the article currency.
///</summary>
[ApiMember(Description="Optional currency override. If not provided, uses the article currency.")]
public virtual string CurrencyId { get; set; }
}
public partial class CustomerArticleCompanyResponse
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual string LogoType { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
public virtual string City { get; set; }
public virtual string Street1 { get; set; }
public virtual string ZipCode { get; set; }
public virtual string CountryId { get; set; }
}
public partial class CustomerArticleCustomerResponse
{
public virtual Guid Id { get; set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
}
public partial class CustomerArticleResponse
{
public virtual int Id { get; set; }
public virtual Guid CompanyId { get; set; }
public virtual int? ArticleId { get; set; }
public virtual decimal? Price { get; set; }
public virtual decimal? VAT { get; set; }
public virtual string CurrencyId { get; set; }
public virtual int StatusId { get; set; }
public virtual string StatusName { get; set; }
public virtual Guid? CustomerId { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual ArticleResponse Article { get; set; }
public virtual CustomerArticleCustomerResponse Customer { get; set; }
public virtual CustomerArticleCompanyResponse Company { get; set; }
public virtual List<PaymentLogResponse> PaymentLog { get; set; } = [];
public virtual ResponseStatus ResponseStatus { get; set; }
}
public partial class PaymentLogResponse
{
public virtual int Id { get; set; }
public virtual double? Amount { get; set; }
public virtual double? AmountCredited { get; set; }
public virtual string CurrencyId { get; set; }
public virtual string Comments { get; set; }
public virtual DateTime Created { get; set; }
public virtual DateTime Updated { get; set; }
}
}
namespace BokaMera.API.ServiceModel.Enums
{
public enum CustomerArticleStatusEnum
{
AwaitingPayment = 1,
AwaitingPaymentFromProvider = 2,
AwaitingPaymentNoTimeLimit = 3,
Active = 4,
Off = 5,
}
}
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 /customerarticle HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
ArticleId: 0,
StatusId: 0,
Price: 0,
VAT: 0,
CurrencyId: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Id: 0,
ArticleId: 0,
Price: 0,
VAT: 0,
CurrencyId: String,
StatusId: 0,
StatusName: String,
CustomerId: 00000000-0000-0000-0000-000000000000,
Article:
{
Id: 0,
Name: String,
ArticleTypeId: 0,
Description: String,
ImageUrl: String,
Active: False,
Amount: 0,
Price: 0,
CurrencyId: String,
SortOrder: 0,
Duration: 0,
Services:
[
{
Id: 0,
ServiceId: 0,
ArticleId: 0
}
],
ServiceIds:
[
0
],
PriceSign: String,
VAT: 0,
ValidDays: 0,
SendNotification: False,
NotificationEmail: String
},
Customer:
{
Firstname: String,
Lastname: String,
Email: String,
Phone: String
},
Company:
{
Name: String,
LogoType: String,
Email: String,
Phone: String,
City: String,
Street1: String,
ZipCode: String,
CountryId: String
},
PaymentLog:
[
{
Id: 0,
Amount: 0,
AmountCredited: 0,
CurrencyId: String,
Comments: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}