Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /licenses/company | Add new license to a company | Add a new license to the company for the logged in user. |
---|
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 BaseModel
End Class
Public Partial Class BillingMethod
Inherits BaseModel
Public Sub New()
BillingMethodCountriesRelation = New List(Of BillingMethodCountriesRelation)
End Sub
Public Overridable Property BillingMethodCountriesRelation As List(Of BillingMethodCountriesRelation)
<Required>
Public Overridable Property Name As String
<Required>
Public Overridable Property Description As String
Public Overridable Property ModifiedDate As Nullable(Of DateTimeOffset)
Public Overridable Property Id As Integer
End Class
Public Partial Class BillingMethodCountriesRelation
Inherits BaseModel
<Required>
Public Overridable Property BillingMethodId As Integer
<Required>
Public Overridable Property CountryId As String
Public Overridable Property ModifiedDate As Nullable(Of DateTimeOffset)
End Class
Public Partial Class Country
Inherits BaseModel
<References(GetType(Currency))>
Public Overridable Property CurrencyId As String
Public Overridable Property CurrencyInfo As Currency
<Required>
Public Overridable Property Name As String
Public Overridable Property Culture As String
Public Overridable Property TimeZone As String
Public Overridable Property ModifiedDate As Nullable(Of DateTimeOffset)
<Required>
Public Overridable Property Id As String
End Class
Public Partial Class Currency
Inherits BaseModel
<Required>
Public Overridable Property Name As String
<Required>
Public Overridable Property CurrencySign As String
<Required>
Public Overridable Property Active As Boolean
Public Overridable Property ModifiedDate As Nullable(Of DateTimeOffset)
<Required>
Public Overridable Property Id As String
End Class
Public Partial Class LicensePrice
Inherits BaseModel
<Ignore>
Public Overridable Property Country As Country
<Ignore>
Public Overridable Property MonthlyPayment As Boolean
<Required>
Public Overridable Property LicenseTypeId As Integer
<Required>
Public Overridable Property CountryId As String
<Required>
Public Overridable Property Price As Integer
Public Overridable Property ModifiedDate As Nullable(Of DateTimeOffset)
End Class
End Namespace
Namespace BokaMera.API.ServiceModel.Dtos
Public Partial Class BillingInformationResponse
Public Sub New()
BillingMethodOptions = New List(Of BillingMethod)
End Sub
'''<Summary>
'''The company id.
'''</Summary>
<ApiMember(Description:="The company id.")>
Public Overridable Property CompanyId As Guid
'''<Summary>
'''The prefered billing method.
'''</Summary>
<ApiMember(Description:="The prefered billing method.", IsRequired:=true)>
Public Overridable Property BillingMethodId As Integer
'''<Summary>
'''The name that should be printed on the billing information, normally this would be your company name.
'''</Summary>
<ApiMember(Description:="The name that should be printed on the billing information, normally this would be your company name.")>
Public Overridable Property Name As String
'''<Summary>
'''If you want to add the attention to the billing address.
'''</Summary>
<ApiMember(Description:="If you want to add the attention to the billing address.")>
Public Overridable Property Attention As String
'''<Summary>
'''The street for the billing adress. This is required when having postal invoice as billing method.
'''</Summary>
<ApiMember(Description:="The street for the billing adress. This is required when having postal invoice as billing method.")>
Public Overridable Property Street1 As String
'''<Summary>
'''The street for the billing adress.
'''</Summary>
<ApiMember(Description:="The street for the billing adress.")>
Public Overridable Property Street2 As String
'''<Summary>
'''The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method.
'''</Summary>
<ApiMember(Description:="The zip code (postal code) for the billing adress. This is required when having postal invoice as billing method.")>
Public Overridable Property ZipCode As String
'''<Summary>
'''The city for the billing adress. This is required when having postal invoice as billing method.
'''</Summary>
<ApiMember(Description:="The city for the billing adress. This is required when having postal invoice as billing method.")>
Public Overridable Property City As String
'''<Summary>
'''The country for the billing adress. This is required when having postal invoice as billing method.
'''</Summary>
<ApiMember(Description:="The country for the billing adress. This is required when having postal invoice as billing method.")>
Public Overridable Property CountryId As String
'''<Summary>
'''The billing email. This is required when having email invoice as billing method.
'''</Summary>
<ApiMember(Description:="The billing email. This is required when having email invoice as billing method.")>
Public Overridable Property Email As String
'''<Summary>
'''The company global location number.
'''</Summary>
<ApiMember(Description:="The company global location number.")>
Public Overridable Property GLN As String
'''<Summary>
'''You're internal rereference.
'''</Summary>
<ApiMember(Description:="You're internal rereference.")>
Public Overridable Property ReferenceLine1 As String
'''<Summary>
'''You're internal rereference.
'''</Summary>
<ApiMember(Description:="You're internal rereference.")>
Public Overridable Property ReferenceLine2 As String
'''<Summary>
'''The billing payment terms in days. This is default 15 days.
'''</Summary>
<ApiMember(Description:="The billing payment terms in days. This is default 15 days.")>
Public Overridable Property PaymentTermsDays As Integer
'''<Summary>
'''The company vat registration number.
'''</Summary>
<ApiMember(Description:="The company vat registration number.")>
Public Overridable Property VatRegistrationNumber As String
'''<Summary>
'''The billing method options to choose from
'''</Summary>
<ApiMember(Description:="The billing method options to choose from")>
Public Overridable Property BillingMethodOptions As List(Of BillingMethod)
End Class
Public Partial Class CompanyLicenseQueryResponse
Public Overridable Property Id As Integer
Public Overridable Property TypeId As Integer
Public Overridable Property Type As LicenseTypeQueryResponse
Public Overridable Property ValidFrom As Date
Public Overridable Property ValidTo As Date
Public Overridable Property MetaData As String
Public Overridable Property Active As Boolean
Public Overridable Property Canceled As Boolean
Public Overridable Property Updated As Date
Public Overridable Property Created As Date
End Class
<ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class CreateLicense
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 Nullable(Of Guid)
'''<Summary>
'''Id of the license type
'''</Summary>
<ApiMember(Description:="Id of the license type", IsRequired:=true)>
Public Overridable Property TypeId As Nullable(Of Integer)
'''<Summary>
'''Any metadata connected to the license. In example for domain license set the requested domain name here.
'''</Summary>
<ApiMember(Description:="Any metadata connected to the license. In example for domain license set the requested domain name here.", IsRequired:=true)>
Public Overridable Property MetaData As String
'''<Summary>
'''If you want to update your company billing information. Note, if no billing information is added before, you need to set this.
'''</Summary>
<ApiMember(Description:="If you want to update your company billing information. Note, if no billing information is added before, you need to set this.")>
Public Overridable Property BillingInformation As BillingInformationResponse
End Class
Public Partial Class LicenseItemsResponse
Public Overridable Property Id As Integer
Public Overridable Property Name As String
Public Overridable Property AllowedItems As Integer
End Class
Public Partial Class LicenseTypeQueryResponse
Public Sub New()
Items = New List(Of LicenseItemsResponse)
Prices = New List(Of LicensePrice)
End Sub
'''<Summary>
'''The license type id
'''</Summary>
<ApiMember(Description:="The license type id")>
Public Overridable Property Id As Integer
'''<Summary>
'''The license type name
'''</Summary>
<ApiMember(Description:="The license type name")>
Public Overridable Property Name As String
'''<Summary>
'''The license type description
'''</Summary>
<ApiMember(Description:="The license type description")>
Public Overridable Property Description As String
'''<Summary>
'''If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.
'''</Summary>
<ApiMember(Description:="If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.")>
Public Overridable Property IsExtraLicenseOption As Boolean
'''<Summary>
'''The period of notice for the license in days.
'''</Summary>
<ApiMember(Description:="The period of notice for the license in days.")>
Public Overridable Property PeriodOfNoticeDays As Integer
'''<Summary>
'''The license items for the license type
'''</Summary>
<ApiMember(Description:="The license items for the license type")>
Public Overridable Property Items As List(Of LicenseItemsResponse)
'''<Summary>
'''The license prices in each country for the license type
'''</Summary>
<ApiMember(Description:="The license prices in each country for the license type")>
Public Overridable Property Prices As List(Of LicensePrice)
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 /licenses/company HTTP/1.1
Host: api.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","TypeId":0,"MetaData":"String","BillingInformation":{"BillingMethodId":0,"Name":"String","Attention":"String","Street1":"String","Street2":"String","ZipCode":"String","City":"String","CountryId":"String","Email":"String","GLN":"String","ReferenceLine1":"String","ReferenceLine2":"String","PaymentTermsDays":0,"VatRegistrationNumber":"String","BillingMethodOptions":[{"BillingMethodCountriesRelation":[{"BillingMethodId":0,"CountryId":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00"}],"Name":"String","Description":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":0}]}}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Id":0,"TypeId":0,"Type":{"Id":0,"Name":"String","Description":"String","IsExtraLicenseOption":false,"PeriodOfNoticeDays":0,"Items":[{"Id":0,"Name":"String","AllowedItems":0}],"Prices":[{"Country":{"CurrencyId":"String","CurrencyInfo":{"Name":"String","CurrencySign":"String","Active":false,"ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":"String"},"Name":"String","Culture":"String","TimeZone":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":"String"},"MonthlyPayment":true,"LicenseTypeId":0,"CountryId":"String","Price":0,"ModifiedDate":"0001-01-01T00:00:00.0000000+00:00"}]},"MetaData":"String","Active":false,"Canceled":false}