Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
DELETE | /resource/{Id} | Delete a resource | Delete a resource for the currently logged in user, only administrators are allowed to delete 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 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)>
<ApiResponse(Description:="Bookings exists that needs to be unbooked before creating this time exceptions, use the /timeexceptions/collidingevents to find which bookings and use the booking service to unbook them", StatusCode:=409)>
<ValidateRequest(Validator:="IsAuthenticated")>
Public Partial Class DeleteResource
Implements ICompany
'''<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>
'''Id of the resource to delete
'''</Summary>
<ApiMember(Description:="Id of the resource to delete", IsRequired:=true)>
Public Overridable Property Id As Integer
'''<Summary>
'''If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted.
'''</Summary>
<ApiMember(Description:="If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted. ")>
Public Overridable Property Force As Boolean
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 .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
DELETE /resource/{Id} HTTP/1.1 Host: testapi.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ResourceQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <AccessGroup>String</AccessGroup> <Active>false</Active> <Bookings> <BookedTime> <BookedSpots>0</BookedSpots> <Customer> <CorporateIdentityNumber>String</CorporateIdentityNumber> <Email>String</Email> <FacebookUserName>String</FacebookUserName> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <InvoiceAddress1>String</InvoiceAddress1> <InvoiceAddress2>String</InvoiceAddress2> <InvoiceCity>String</InvoiceCity> <InvoiceCountryCode>String</InvoiceCountryCode> <InvoicePostalCode>String</InvoicePostalCode> <Lastname>String</Lastname> <Phone>String</Phone> </Customer> <From>0001-01-01T00:00:00</From> <Id>0</Id> <PauseAfterInMinutes>0</PauseAfterInMinutes> <ServiceId>0</ServiceId> <Status>Booked</Status> <StatusId>0</StatusId> <To>0001-01-01T00:00:00</To> <TotalSpots>0</TotalSpots> </BookedTime> </Bookings> <Color>String</Color> <Created>0001-01-01T00:00:00</Created> <Description>String</Description> <Email>String</Email> <EmailNotification>false</EmailNotification> <Exceptions> <TimeException> <From>0001-01-01T00:00:00</From> <Id>0</Id> <IsBlock>false</IsBlock> <IsRecurring>false</IsRecurring> <ReasonText>String</ReasonText> <ReasonTextPublic>String</ReasonTextPublic> <ResourceIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:int>0</d4p1:int> </ResourceIds> <To>0001-01-01T00:00:00</To> </TimeException> </Exceptions> <Id>0</Id> <ImageUrl i:nil="true" /> <MobilePhone>String</MobilePhone> <Name>String</Name> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <SMSNotification>false</SMSNotification> <SendEmailReminder>false</SendEmailReminder> <SendSMSReminder>false</SendSMSReminder> <Updated>0001-01-01T00:00:00</Updated> </ResourceQueryResponse>