Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /resource | Add a new resource | Add a new resource to the company of the currently logged in user, only administrators are allowed to add resources. |
---|
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.Enums
Namespace Global
Namespace BokaMera.API.ServiceModel.Dtos
Public Partial Class AddCustomField
Public Overridable Property Id As Integer
Public Overridable Property Value As String
End Class
Public Partial Class BookedCustomer
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 FacebookUserName As String
Public Overridable Property ImageUrl As String
Public Overridable Property CorporateIdentityNumber As String
Public Overridable Property InvoiceAddress1 As String
Public Overridable Property InvoiceAddress2 As String
Public Overridable Property InvoiceCity As String
Public Overridable Property InvoicePostalCode As String
Public Overridable Property InvoiceCountryCode As String
End Class
Public Partial Class BookedTime
Implements IBookedTime
'''<Summary>
'''Booking id
'''</Summary>
<ApiMember(Description:="Booking id")>
Public Overridable Property Id As Integer
'''<Summary>
'''The booked service
'''</Summary>
<ApiMember(Description:="The booked service")>
Public Overridable Property ServiceId As Integer
'''<Summary>
'''Booking start
'''</Summary>
<ApiMember(Description:="Booking start")>
Public Overridable Property From As Date
'''<Summary>
'''Booking end
'''</Summary>
<ApiMember(Description:="Booking end")>
Public Overridable Property To As Date
'''<Summary>
'''Number of booked spots
'''</Summary>
<ApiMember(Description:="Number of booked spots")>
Public Overridable Property BookedSpots As Integer
'''<Summary>
'''Number of total spots for the service
'''</Summary>
<ApiMember(Description:="Number of total spots for the service")>
Public Overridable Property TotalSpots As Integer
'''<Summary>
'''The pause after the booking
'''</Summary>
<ApiMember(Description:="The pause after the booking")>
Public Overridable Property PauseAfterInMinutes As Integer
'''<Summary>
'''The booking status
'''</Summary>
<ApiMember(Description:="The booking status")>
Public Overridable Property StatusId As Integer
Public Overridable Property Status As BookingStatusEnum
'''<Summary>
'''The customer the booking belongs to
'''</Summary>
<ApiMember(Description:="The customer the booking belongs to")>
Public Overridable Property Customer As BookedCustomer
End Class
<ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
<ApiResponse(Description:="You have too low privilegies to call this service", StatusCode:=403)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class CreateResource
Implements ICompany
Public Sub New()
CustomFields = New List(Of AddCustomField)
End Sub
'''<Summary>
'''Enter the company id, if blank company id and you are an admin, your company id will be used.
'''</Summary>
<ApiMember(Description:="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired:=true)>
Public Overridable Property CompanyId As Nullable(Of Guid)
'''<Summary>
'''The resource name
'''</Summary>
<ApiMember(Description:="The resource name")>
Public Overridable Property Name As String
'''<Summary>
'''The resource description
'''</Summary>
<ApiMember(Description:="The resource description")>
Public Overridable Property Description As String
'''<Summary>
'''If resource is active or not. Default is active.
'''</Summary>
<ApiMember(Description:="If resource is active or not. Default is active.")>
Public Overridable Property Active As Boolean
'''<Summary>
'''The resource color in scheduler
'''</Summary>
<ApiMember(Description:="The resource color in scheduler")>
Public Overridable Property Color As String
'''<Summary>
'''The email of the resource
'''</Summary>
<ApiMember(Description:="The email of the resource")>
Public Overridable Property Email As String
'''<Summary>
'''The image url of the resource
'''</Summary>
<ApiMember(Description:="The image url of the resource")>
Public Overridable Property ImageUrl As Uri
'''<Summary>
'''Used by example code locks to know what access group the resource is assigned to
'''</Summary>
<ApiMember(Description:="Used by example code locks to know what access group the resource is assigned to")>
Public Overridable Property AccessGroup As String
'''<Summary>
'''The mobile phone number of the resource
'''</Summary>
<ApiMember(Description:="The mobile phone number of the resource")>
Public Overridable Property MobilePhone As String
'''<Summary>
'''If the resource should receive email notification when booked
'''</Summary>
<ApiMember(Description:="If the resource should receive email notification when booked")>
Public Overridable Property EmailNotification As Nullable(Of Boolean)
'''<Summary>
'''If the resource should receive SMS notification when booked
'''</Summary>
<ApiMember(Description:="If the resource should receive SMS notification when booked")>
Public Overridable Property SMSNotification As Nullable(Of Boolean)
'''<Summary>
'''If the resource should receive email reminders on bookings
'''</Summary>
<ApiMember(Description:="If the resource should receive email reminders on bookings")>
Public Overridable Property SendEmailReminder As Nullable(Of Boolean)
'''<Summary>
'''If the resource should receive SMS reminders on bookings
'''</Summary>
<ApiMember(Description:="If the resource should receive SMS reminders on bookings")>
Public Overridable Property SendSMSReminder As Nullable(Of Boolean)
'''<Summary>
'''If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved
'''</Summary>
<ApiMember(Description:="If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved")>
Public Overridable Property CustomFields As List(Of AddCustomField)
End Class
Public Partial Class ResourceQueryResponse
Public Sub New()
Exceptions = New List(Of TimeException)
Bookings = New List(Of BookedTime)
End Sub
'''<Summary>
'''The resource id
'''</Summary>
<ApiMember(Description:="The resource id")>
Public Overridable Property Id As Integer
'''<Summary>
'''The resource name
'''</Summary>
<ApiMember(Description:="The resource name")>
Public Overridable Property Name As String
'''<Summary>
'''The resource description
'''</Summary>
<ApiMember(Description:="The resource description")>
Public Overridable Property Description As String
'''<Summary>
'''If resource is active or not
'''</Summary>
<ApiMember(Description:="If resource is active or not")>
Public Overridable Property Active As Boolean
'''<Summary>
'''The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
'''</Summary>
<ApiMember(Description:="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")>
Public Overridable Property Color As String
'''<Summary>
'''The email of the resource
'''</Summary>
<ApiMember(Description:="The email of the resource")>
Public Overridable Property Email As String
'''<Summary>
'''The image url of the resource
'''</Summary>
<ApiMember(Description:="The image url of the resource")>
Public Overridable Property ImageUrl As Uri
'''<Summary>
'''The mobile phone number of the resource
'''</Summary>
<ApiMember(Description:="The mobile phone number of the resource")>
Public Overridable Property MobilePhone As String
'''<Summary>
'''Used by example code locks to know what access group the resource is assigned to
'''</Summary>
<ApiMember(Description:="Used by example code locks to know what access group the resource is assigned to")>
Public Overridable Property AccessGroup As String
'''<Summary>
'''If the resource should receive email notification when booked
'''</Summary>
<ApiMember(Description:="If the resource should receive email notification when booked")>
Public Overridable Property EmailNotification As Boolean
'''<Summary>
'''If the resource should receive SMS notification when booked
'''</Summary>
<ApiMember(Description:="If the resource should receive SMS notification when booked")>
Public Overridable Property SMSNotification As Boolean
'''<Summary>
'''If the resource should receive email reminders on bookings
'''</Summary>
<ApiMember(Description:="If the resource should receive email reminders on bookings")>
Public Overridable Property SendEmailReminder As Nullable(Of Boolean)
'''<Summary>
'''If the resource should receive SMS reminders on bookings
'''</Summary>
<ApiMember(Description:="If the resource should receive SMS reminders on bookings")>
Public Overridable Property SendSMSReminder As Nullable(Of Boolean)
'''<Summary>
'''The resource time exceptions
'''</Summary>
<ApiMember(Description:="The resource time exceptions")>
Public Overridable Property Exceptions As List(Of TimeException)
'''<Summary>
'''The resource bookings
'''</Summary>
<ApiMember(Description:="The resource bookings")>
Public Overridable Property Bookings As List(Of BookedTime)
'''<Summary>
'''Then date when the resource was created
'''</Summary>
<ApiMember(Description:="Then date when the resource was created")>
Public Overridable Property Created As Date
'''<Summary>
'''Then date when the resource was updated
'''</Summary>
<ApiMember(Description:="Then date when the resource was updated")>
Public Overridable Property Updated As Date
Public Overridable Property ResponseStatus As ResponseStatus
End Class
Public Partial Class TimeException
Implements ITimeException
Public Sub New()
ResourceIds = New Integer(){}
End Sub
'''<Summary>
'''Time exception id
'''</Summary>
<ApiMember(Description:="Time exception id")>
Public Overridable Property Id As Integer
'''<Summary>
'''Indicates whether or not the time exception is recurring
'''</Summary>
<ApiMember(Description:="Indicates whether or not the time exception is recurring")>
Public Overridable Property IsRecurring As Boolean
'''<Summary>
'''Indicates whether the time exception is blocking the time or not
'''</Summary>
<ApiMember(Description:="Indicates whether the time exception is blocking the time or not")>
Public Overridable Property IsBlock As Boolean
'''<Summary>
'''The reason of the time exception, example: Vacation, doctors appointment, ...
'''</Summary>
<ApiMember(Description:="The reason of the time exception, example: Vacation, doctors appointment, ...")>
Public Overridable Property ReasonText As String
'''<Summary>
'''The public reason of the time exception, example: Vacation, doctors appointment, ...
'''</Summary>
<ApiMember(Description:="The public reason of the time exception, example: Vacation, doctors appointment, ...")>
Public Overridable Property ReasonTextPublic As String
'''<Summary>
'''Time exception start
'''</Summary>
<ApiMember(Description:="Time exception start")>
Public Overridable Property From As Date
'''<Summary>
'''Time exception end
'''</Summary>
<ApiMember(Description:="Time exception end")>
Public Overridable Property To As Date
'''<Summary>
'''Resources that owns this exception
'''</Summary>
<ApiMember(Description:="Resources that owns this exception")>
Public Overridable Property ResourceIds As Integer()
End Class
End Namespace
Namespace BokaMera.API.ServiceModel.Enums
Public Enum BookingStatusEnum
Booked = 1
Unbooked = 2
Reserved = 3
Canceled = 4
AwaitingPayment = 5
AwaitingPaymentNoTimeLimit = 6
Payed = 7
AwaitingPaymentRequestFromAdmin = 8
AwaitingPaymentFromProvider = 9
Invoiced = 10
End Enum
End Namespace
End Namespace
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 /resource HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
Name: String,
Description: String,
Active: False,
Color: String,
Email: String,
AccessGroup: String,
MobilePhone: String,
EmailNotification: False,
SMSNotification: False,
SendEmailReminder: False,
SendSMSReminder: False,
CustomFields:
[
{
Id: 0,
Value: String
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Id: 0, Name: String, Description: String, Active: False, Color: String, Email: String, MobilePhone: String, AccessGroup: String, EmailNotification: False, SMSNotification: False, SendEmailReminder: False, SendSMSReminder: False, Exceptions: [ { Id: 0, IsRecurring: False, IsBlock: False, ReasonText: String, ReasonTextPublic: String, ResourceIds: [ 0 ] } ], Bookings: [ { Id: 0, ServiceId: 0, BookedSpots: 0, TotalSpots: 0, PauseAfterInMinutes: 0, StatusId: 0, Status: Booked, Customer: { Firstname: String, Lastname: String, Email: String, Phone: String, FacebookUserName: String, ImageUrl: String, CorporateIdentityNumber: String, InvoiceAddress1: String, InvoiceAddress2: String, InvoiceCity: String, InvoicePostalCode: String, InvoiceCountryCode: String } } ], ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } }