| 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. |
|---|
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
@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 exist that need to be unbooked before creating this time exception, use the /timeexceptions/collidingevents to find which bookings and use the booking service to unbook them", StatusCode=409)
@ValidateRequest(Validator="IsAuthenticated")
open class DeleteResource : ICompany
{
/**
* Enter the company id, if blank company id and you are an admin, your company id will be used.
*/
@ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
override var CompanyId:UUID? = null
/**
* Id of the resource to delete
*/
@ApiMember(Description="Id of the resource to delete", IsRequired=true)
open var Id:Int? = null
/**
* If this equals true it will force to set the resource as active = false, this is used when bookings exist on the resource and it cannot be deleted.
*/
@ApiMember(Description="If this equals true it will force to set the resource as active = false, this is used when bookings exist on the resource and it cannot be deleted. ")
open var Force:Boolean? = null
}
open class ResourceQueryResponse
{
/**
* The resource id
*/
@ApiMember(Description="The resource id")
open var Id:Int? = null
/**
* The resource name
*/
@ApiMember(Description="The resource name")
open var Name:String? = null
/**
* The resource description
*/
@ApiMember(Description="The resource description")
open var Description:String? = null
/**
* If resource is active or not
*/
@ApiMember(Description="If resource is active or not")
open var Active:Boolean? = null
/**
* The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
*/
@ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
open var Color:String? = null
/**
* The Email of the resource
*/
@ApiMember(Description="The Email of the resource")
open var Email:String? = null
/**
* The Image URL of the resource
*/
@ApiMember(Description="The Image URL of the resource")
open var ImageUrl:Uri? = null
/**
* The Mobile phone number of the resource
*/
@ApiMember(Description="The Mobile phone number of the resource")
open var MobilePhone:String? = null
/**
* Used by example code locks to know what access group the resource is assigned to
*/
@ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
open var AccessGroup:String? = null
/**
* If the resource should receive Email notification when booked
*/
@ApiMember(Description="If the resource should receive Email notification when booked")
open var EmailNotification:Boolean? = null
/**
* If the resource should receive SMS notification when booked
*/
@ApiMember(Description="If the resource should receive SMS notification when booked")
open var SMSNotification:Boolean? = null
/**
* If the resource should receive Email reminders on bookings
*/
@ApiMember(Description="If the resource should receive Email reminders on bookings")
open var SendEmailReminder:Boolean? = null
/**
* If the resource should receive SMS reminders on bookings
*/
@ApiMember(Description="If the resource should receive SMS reminders on bookings")
open var SendSMSReminder:Boolean? = null
/**
* The resource time exceptions
*/
@ApiMember(Description="The resource time exceptions")
open var Exceptions:ArrayList<TimeException> = ArrayList<TimeException>()
/**
* The resource bookings
*/
@ApiMember(Description="The resource bookings")
open var Bookings:ArrayList<BookedTime> = ArrayList<BookedTime>()
/**
* The date when the resource was created
*/
@ApiMember(Description="The date when the resource was created")
open var Created:Date? = null
/**
* The date when the resource was updated
*/
@ApiMember(Description="The date when the resource was updated")
open var Updated:Date? = null
open var ResponseStatus:ResponseStatus? = null
}
open class TimeException : ITimeException
{
/**
* Time exception id
*/
@ApiMember(Description="Time exception id")
override var Id:Int? = null
/**
* Indicates whether or not the time exception is recurring
*/
@ApiMember(Description="Indicates whether or not the time exception is recurring")
override var IsRecurring:Boolean? = null
/**
* Indicates whether the time exception is blocking the time or not
*/
@ApiMember(Description="Indicates whether the time exception is blocking the time or not")
override var IsBlock:Boolean? = null
/**
* The reason of the time exception, example: Vacation, doctors appointment, ...
*/
@ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
override var ReasonText:String? = null
/**
* The public reason of the time exception, example: Vacation, doctors appointment, ...
*/
@ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
override var ReasonTextPublic:String? = null
/**
* Time exception start
*/
@ApiMember(Description="Time exception start")
open var From:Date? = null
/**
* Time exception end
*/
@ApiMember(Description="Time exception end")
open var To:Date? = null
/**
* Resources that owns this exception
*/
@ApiMember(Description="Resources that owns this exception")
override var ResourceIds:ArrayList<Int> = ArrayList<Int>()
}
open class BookedTime : IBookedTime
{
/**
* Booking id
*/
@ApiMember(Description="Booking id")
override var Id:Int? = null
/**
* The booked service
*/
@ApiMember(Description="The booked service")
override var ServiceId:Int? = null
/**
* Booking start
*/
@ApiMember(Description="Booking start")
open var From:Date? = null
/**
* Booking end
*/
@ApiMember(Description="Booking end")
open var To:Date? = null
/**
* Number of booked spots
*/
@ApiMember(Description="Number of booked spots")
override var BookedSpots:Int? = null
/**
* Number of total spots for the service
*/
@ApiMember(Description="Number of total spots for the service")
override var TotalSpots:Int? = null
/**
* The pause after the booking
*/
@ApiMember(Description="The pause after the booking")
override var PauseAfterInMinutes:Int? = null
/**
* The booking status
*/
@ApiMember(Description="The booking status")
override var StatusId:Int? = null
override var Status:BookingStatusEnum? = null
/**
* The customer the booking belongs to
*/
@ApiMember(Description="The customer the booking belongs to")
override var Customer:BookedCustomer? = null
}
enum class BookingStatusEnum(val value:Int)
{
Booked(1),
Unbooked(2),
Reserved(3),
Canceled(4),
AwaitingPayment(5),
AwaitingPaymentNoTimeLimit(6),
Payed(7),
AwaitingPaymentRequestFromAdmin(8),
AwaitingPaymentFromProvider(9),
Invoiced(10),
}
open class BookedCustomer
{
open var Id:UUID? = null
open var Firstname:String? = null
open var Lastname:String? = null
open var Email:String? = null
open var Phone:String? = null
open var FacebookUserName:String? = null
open var ImageUrl:String? = null
open var CorporateIdentityNumber:String? = null
open var InvoiceAddress1:String? = null
open var InvoiceAddress2:String? = null
open var InvoiceCity:String? = null
open var InvoicePostalCode:String? = null
open var InvoiceCountryCode:String? = null
}
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.
DELETE /resource/{Id} HTTP/1.1
Host: testapi.bokamera.se
Accept: text/jsv
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
}
}
}