| POST | /customerarticle | Create a new CustomerArticle. | Create a new CustomerArticle directly with price, status, and customer. |
|---|
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@ValidateRequest(Validator="IsAuthenticated")
open class CreateCustomerArticle : ICompany
{
/**
* The company id, if empty will use the company id for the user you are logged in with.
*/
@ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
override var CompanyId:UUID? = null
/**
* The article id to base this customer article on
*/
@ApiMember(Description="The article id to base this customer article on", IsRequired=true)
open var ArticleId:Int? = null
/**
* The customer id to assign the article to
*/
@ApiMember(Description="The customer id to assign the article to", IsRequired=true)
open var CustomerId:UUID? = null
/**
* The status of the customer article
*/
@ApiMember(Description="The status of the customer article")
open var StatusId:CustomerArticleStatusEnum? = null
/**
* Optional price override. If not provided, uses the article price.
*/
@ApiMember(Description="Optional price override. If not provided, uses the article price.")
open var Price:BigDecimal? = null
/**
* Optional VAT override. If not provided, uses the article VAT.
*/
@ApiMember(Description="Optional VAT override. If not provided, uses the article VAT.")
open var VAT:BigDecimal? = null
/**
* Optional currency override. If not provided, uses the article currency.
*/
@ApiMember(Description="Optional currency override. If not provided, uses the article currency.")
open var CurrencyId:String? = null
}
enum class CustomerArticleStatusEnum(val value:Int)
{
AwaitingPayment(1),
AwaitingPaymentFromProvider(2),
AwaitingPaymentNoTimeLimit(3),
Active(4),
Off(5),
}
open class CustomerArticleResponse
{
open var Id:Int? = null
open var CompanyId:UUID? = null
open var ArticleId:Int? = null
open var Price:BigDecimal? = null
open var VAT:BigDecimal? = null
open var CurrencyId:String? = null
open var StatusId:Int? = null
open var StatusName:String? = null
open var CustomerId:UUID? = null
open var CreatedDate:Date? = null
open var UpdatedDate:Date? = null
open var Article:ArticleResponse? = null
open var Customer:CustomerArticleCustomerResponse? = null
open var Company:CustomerArticleCompanyResponse? = null
open var PaymentLog:ArrayList<PaymentLogResponse> = ArrayList<PaymentLogResponse>()
open var ResponseStatus:ResponseStatus? = null
}
open class ArticleResponse
{
open var CompanyId:UUID? = null
open var Id:Int? = null
open var Name:String? = null
open var ArticleTypeId:Int? = null
open var Description:String? = null
open var ImageUrl:String? = null
open var Active:Boolean? = null
open var Amount:Int? = null
open var Price:Double? = null
open var CurrencyId:String? = null
open var SortOrder:Int? = null
open var UpdatedDate:Date? = null
open var CreatedDate:Date? = null
open var Duration:Int? = null
open var Services:ArrayList<ArticleServiceRelation> = ArrayList<ArticleServiceRelation>()
open var ServiceIds:ArrayList<Int> = ArrayList<Int>()
open var PriceSign:String? = null
open var VAT:BigDecimal? = null
open var ValidDays:Int? = null
open var SendNotification:Boolean? = null
open var NotificationEmail:String? = null
}
open class ArticleServiceRelation : BaseModel()
{
@Required()
open var CompanyId:UUID? = null
open var Id:Int? = null
@Required()
open var ServiceId:Int? = null
@Required()
open var ArticleId:Int? = null
}
open class BaseModel
{
}
open class CustomerArticleCustomerResponse
{
open var Id:UUID? = null
open var Firstname:String? = null
open var Lastname:String? = null
open var Email:String? = null
open var Phone:String? = null
}
open class CustomerArticleCompanyResponse
{
open var Id:UUID? = null
open var Name:String? = null
open var LogoType:String? = null
open var Email:String? = null
open var Phone:String? = null
open var City:String? = null
open var Street1:String? = null
open var ZipCode:String? = null
open var CountryId:String? = null
}
open class PaymentLogResponse
{
open var Id:Int? = null
open var Amount:Double? = null
open var AmountCredited:Double? = null
open var CurrencyId:String? = null
open var Comments:String? = null
open var Created:Date? = null
open var Updated:Date? = null
}
Kotlin CreateCustomerArticle DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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/jsonl
Content-Type: text/jsonl
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/jsonl
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"}}}