| POST | /customerarticle | Create a new CustomerArticle. | Create a new CustomerArticle directly with price, status, and customer. |
|---|
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BokaMera.API.ServiceModel.Dtos
Imports BokaMera.API.ServiceModel.Enums
Imports BokaMera.API.ServiceModel.Db
Namespace Global
Namespace BokaMera.API.ServiceModel.Db
Public Partial Class ArticleServiceRelation
Inherits BaseModel
<Required>
Public Overridable Property CompanyId As Guid
Public Overridable Property Id As Integer
<Required>
Public Overridable Property ServiceId As Integer
<Required>
Public Overridable Property ArticleId As Integer
End Class
Public Partial Class BaseModel
End Class
End Namespace
Namespace BokaMera.API.ServiceModel.Dtos
Public Partial Class ArticleResponse
Public Overridable Property CompanyId As Guid
Public Overridable Property Id As Integer
Public Overridable Property Name As String
Public Overridable Property ArticleTypeId As Integer
Public Overridable Property Description As String
Public Overridable Property ImageUrl As String
Public Overridable Property Active As Boolean
Public Overridable Property Amount As Integer
Public Overridable Property Price As Double
Public Overridable Property CurrencyId As String
Public Overridable Property SortOrder As Integer
Public Overridable Property UpdatedDate As Date
Public Overridable Property CreatedDate As Date
Public Overridable Property Duration As Integer
Public Overridable Property Services As List(Of ArticleServiceRelation) = New List(Of ArticleServiceRelation)
Public Overridable Property ServiceIds As List(Of Integer) = New List(Of Integer)
Public Overridable Property PriceSign As String
Public Overridable Property VAT As Decimal?
Public Overridable Property ValidDays As Integer
Public Overridable Property SendNotification As Boolean
Public Overridable Property NotificationEmail As String
End Class
<ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class CreateCustomerArticle
Implements 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 Overridable Property CompanyId As Guid? Implements ICompany.CompanyId
'''<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 Overridable Property ArticleId As Integer
'''<Summary>
'''The customer id to assign the article to
'''</Summary>
<ApiMember(Description:="The customer id to assign the article to", IsRequired:=true)>
Public Overridable Property CustomerId As Guid
'''<Summary>
'''The status of the customer article
'''</Summary>
<ApiMember(Description:="The status of the customer article")>
Public Overridable Property StatusId As CustomerArticleStatusEnum?
'''<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 Overridable Property Price As Decimal?
'''<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 Overridable Property VAT As Decimal?
'''<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 Overridable Property CurrencyId As String
End Class
Public Partial Class CustomerArticleCompanyResponse
Public Overridable Property Id As Guid
Public Overridable Property Name As String
Public Overridable Property LogoType As String
Public Overridable Property Email As String
Public Overridable Property Phone As String
Public Overridable Property City As String
Public Overridable Property Street1 As String
Public Overridable Property ZipCode As String
Public Overridable Property CountryId As String
End Class
Public Partial Class CustomerArticleCustomerResponse
Public Overridable Property Id As Guid
Public Overridable Property Firstname As String
Public Overridable Property Lastname As String
Public Overridable Property Email As String
Public Overridable Property Phone As String
End Class
Public Partial Class CustomerArticleResponse
Public Overridable Property Id As Integer
Public Overridable Property CompanyId As Guid
Public Overridable Property ArticleId As Integer?
Public Overridable Property Price As Decimal?
Public Overridable Property VAT As Decimal?
Public Overridable Property CurrencyId As String
Public Overridable Property StatusId As Integer
Public Overridable Property StatusName As String
Public Overridable Property CustomerId As Guid?
Public Overridable Property CreatedDate As Date
Public Overridable Property UpdatedDate As Date
Public Overridable Property Article As ArticleResponse
Public Overridable Property Customer As CustomerArticleCustomerResponse
Public Overridable Property Company As CustomerArticleCompanyResponse
Public Overridable Property PaymentLog As List(Of PaymentLogResponse) = New List(Of PaymentLogResponse)
Public Overridable Property ResponseStatus As ResponseStatus
End Class
Public Partial Class PaymentLogResponse
Public Overridable Property Id As Integer
Public Overridable Property Amount As Double?
Public Overridable Property AmountCredited As Double?
Public Overridable Property CurrencyId As String
Public Overridable Property Comments As String
Public Overridable Property Created As Date
Public Overridable Property Updated As Date
End Class
End Namespace
Namespace BokaMera.API.ServiceModel.Enums
Public Enum CustomerArticleStatusEnum
AwaitingPayment = 1
AwaitingPaymentFromProvider = 2
AwaitingPaymentNoTimeLimit = 3
Active = 4
Off = 5
End Enum
End Namespace
End Namespace
VB.NET 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"}}}