Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /rebatecodes | Create RebateCode. | Create RebateCode. |
---|
Imports System
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.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 Sub New()
Services = New List(Of ArticleServiceRelation)
ServiceIds = New List(Of Integer)
End Sub
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 UpdatedDate As Date
Public Overridable Property CreatedDate As Date
Public Overridable Property Services As List(Of ArticleServiceRelation)
Public Overridable Property ServiceIds As List(Of Integer)
Public Overridable Property PriceSign As String
End Class
<ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class CreateRebateCode
Public Sub New()
DaysOfWeek = New List(Of Integer)
Services = New List(Of Integer)
Customers = New List(Of Guid)
End Sub
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="")>
Public Overridable Property CompanyId As Nullable(Of Guid)
'''<Summary>
'''The default value is 9999
'''</Summary>
<ApiMember(Description:="The default value is 9999")>
Public Overridable Property MaxNumberOfUses As Nullable(Of Integer)
'''<Summary>
'''The default value is 1
'''</Summary>
<ApiMember(Description:="The default value is 1")>
Public Overridable Property MaxNumberOfUsesPerCustomer As Nullable(Of Integer)
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="", IsRequired:=true)>
Public Overridable Property ValidFrom As Date
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="", IsRequired:=true)>
Public Overridable Property ValidTo As Date
'''<Summary>
'''If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
'''</Summary>
<ApiMember(Description:="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")>
Public Overridable Property FromTime As Nullable(Of TimeSpan)
'''<Summary>
'''If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
'''</Summary>
<ApiMember(Description:="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")>
Public Overridable Property ToTime As Nullable(Of TimeSpan)
'''<Summary>
'''1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard
'''</Summary>
<ApiMember(Description:="1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard", IsRequired:=true)>
Public Overridable Property RebateCodeTypeId As Integer
'''<Summary>
'''If it's connected to an Article, add the Article Id here.
'''</Summary>
<ApiMember(Description:="If it's connected to an Article, add the Article Id here.")>
Public Overridable Property ArticleId As Nullable(Of Integer)
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="", IsRequired:=true)>
Public Overridable Property RebateCodeValue As Integer
'''<Summary>
'''If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes
'''</Summary>
<ApiMember(Description:="If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes")>
Public Overridable Property RebateCodeSign As String
'''<Summary>
'''AutoGenerateRebateCodeSign=true - random generate code
'''</Summary>
<ApiMember(Description:="AutoGenerateRebateCodeSign=true - random generate code")>
Public Overridable Property AutoGenerateRebateCodeSign As Boolean
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="")>
Public Overridable Property PersonalNote As String
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="")>
Public Overridable Property DaysOfWeek As List(Of Integer)
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="")>
Public Overridable Property Services As List(Of Integer)
'''<Summary>
'''
'''</Summary>
<ApiMember(Description:="")>
Public Overridable Property Customers As List(Of Guid)
'''<Summary>
'''The price
'''</Summary>
<ApiMember(Description:="The price")>
Public Overridable Property PriceVat As Nullable(Of Decimal)
'''<Summary>
'''The price currency
'''</Summary>
<ApiMember(Description:="The price currency")>
Public Overridable Property CurrencyId As String
'''<Summary>
'''Promo code Receiver infomration
'''</Summary>
<ApiMember(Description:="Promo code Receiver infomration")>
Public Overridable Property PromoCodeReceiver As PromoCodeReceiver
End Class
Public Partial Class DaysOfWeekResponse
Public Overridable Property Id As Integer
Public Overridable Property DayOfWeek As String
Public Overridable Property DayOfWeekTranslation As String
Public Overridable Property DayOfWeekActive As Nullable(Of Boolean)
Public Overridable Property DayOfWeekSortOrder As Nullable(Of Short)
End Class
Public Partial Class PromoCodeReceiver
Public Overridable Property CustomerId As Nullable(Of Guid)
Public Overridable Property Firstname As String
Public Overridable Property Lastname As String
Public Overridable Property Email As String
Public Overridable Property ReceiverMessage As String
End Class
Public Partial Class RebateCodeCustomerResponse
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
Public Overridable Property ImageUrl As String
End Class
Public Partial Class RebateCodeResponse
Public Sub New()
DaysOfWeek = New List(Of DaysOfWeekResponse)
Services = New List(Of RebateCodeServiceResponse)
Transactions = New List(Of RebateCodeTransactionQueryResponse)
Customers = New List(Of RebateCodeCustomerResponse)
End Sub
Public Overridable Property Id As Integer
Public Overridable Property CompanyId As Nullable(Of Guid)
Public Overridable Property ValidFrom As Date
Public Overridable Property ValidTo As Date
'''<Summary>
'''If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
'''</Summary>
<ApiMember(Description:="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")>
Public Overridable Property FromTime As TimeSpan
'''<Summary>
'''If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
'''</Summary>
<ApiMember(Description:="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")>
Public Overridable Property ToTime As TimeSpan
Public Overridable Property CreatedBy As String
Public Overridable Property Created As Date
Public Overridable Property UpdatedBy As String
Public Overridable Property Updated As Date
Public Overridable Property PersonalNote As String
Public Overridable Property RebateCodeSign As String
Public Overridable Property RebateCodeValue As Integer
Public Overridable Property RebateCodeTypeId As Integer
Public Overridable Property Name As String
Public Overridable Property RebateCodeStatusId As Integer
Public Overridable Property StatusName As String
Public Overridable Property MaxNumberOfUses As Integer
Public Overridable Property MaxNumberOfUsesPerCustomer As Integer
Public Overridable Property NumberOfUsesUsed As Integer
Public Overridable Property DaysOfWeek As List(Of DaysOfWeekResponse)
Public Overridable Property Services As List(Of RebateCodeServiceResponse)
Public Overridable Property Article As ArticleResponse
Public Overridable Property Transactions As List(Of RebateCodeTransactionQueryResponse)
Public Overridable Property RemainingAmount As Nullable(Of Double)
Public Overridable Property RemainingUsage As Nullable(Of Integer)
Public Overridable Property Customers As List(Of RebateCodeCustomerResponse)
Public Overridable Property ResponseStatus As ResponseStatus
Public Overridable Property PaymentReceived As Boolean
Public Overridable Property RebateCodeCurrencySign As String
Public Overridable Property ActiveByStatus As Boolean
Public Overridable Property PriceSign As String
Public Overridable Property RebateCodeTypeName As String
End Class
Public Partial Class RebateCodeServiceResponse
Public Overridable Property Id As Integer
Public Overridable Property Name As String
Public Overridable Property Description As String
Public Overridable Property Active As Boolean
End Class
Public Partial Class RebateCodeTransactionQueryResponse
Public Overridable Property Id As Integer
Public Overridable Property CompanyId As Guid
Public Overridable Property Note As String
Public Overridable Property RebateCodeId As Integer
Public Overridable Property RebateCodeSign As String
Public Overridable Property RebateCodeTypeId As Nullable(Of Integer)
Public Overridable Property RebateCodeTypeName As String
Public Overridable Property Amount As Double
Public Overridable Property BookingId As Nullable(Of Integer)
Public Overridable Property UpdatedDate As Date
Public Overridable Property CreatedDate As Date
Public Overridable Property Service As RebateCodeServiceResponse
Public Overridable Property Customer As RebateCodeCustomerResponse
Public Overridable Property PriceSign As String
End Class
End Namespace
End Namespace
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /rebatecodes HTTP/1.1
Host: api.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"FromTime":"00:00:00","ToTime":"00:00:00","RebateCodeTypeId":0,"ArticleId":0,"RebateCodeValue":0,"RebateCodeSign":"String","AutoGenerateRebateCodeSign":false,"PersonalNote":"String","DaysOfWeek":[0],"Services":[0],"Customers":["00000000-0000-0000-0000-000000000000"],"PriceVat":0,"CurrencyId":"String","PromoCodeReceiver":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","ReceiverMessage":"String"}}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Id":0,"CompanyId":"00000000-0000-0000-0000-000000000000","FromTime":"00:00:00","ToTime":"00:00:00","CreatedBy":"String","UpdatedBy":"String","PersonalNote":"String","RebateCodeSign":"String","RebateCodeValue":0,"RebateCodeTypeId":0,"Name":"String","RebateCodeStatusId":0,"StatusName":"String","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"NumberOfUsesUsed":0,"DaysOfWeek":[{"Id":0,"DayOfWeek":"String","DayOfWeekTranslation":"String","DayOfWeekActive":false,"DayOfWeekSortOrder":0}],"Services":[{"Id":0,"Name":"String","Description":"String","Active":false}],"Article":{"Id":0,"Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String","Services":[{"Id":0,"ServiceId":0,"ArticleId":0}],"ServiceIds":[0],"PriceSign":"String"},"Transactions":[{"Id":0,"Note":"String","RebateCodeId":0,"RebateCodeSign":"String","RebateCodeTypeId":0,"RebateCodeTypeName":"String","Amount":0,"BookingId":0,"Service":{"Id":0,"Name":"String","Description":"String","Active":false},"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"},"PriceSign":"String"}],"RemainingAmount":0,"RemainingUsage":0,"Customers":[{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"PaymentReceived":false,"RebateCodeCurrencySign":"String","ActiveByStatus":false,"PriceSign":"String","RebateCodeTypeName":"String"}