| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| PUT | /resource/{Id} | Update existing resource | Updates an existing resource if you are authorized to do so. |
|---|
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)
@ValidateRequest(Validator="IsAuthenticated")
open class UpdateResource : 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
*/
@ApiMember(Description="Id of the resource", IsRequired=true, ParameterType="path")
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
*/
@ApiMember(Description="The resource color in scheduler")
open var Color:String? = null
/**
* The Image URL of the resource
*/
@ApiMember(Description="The Image URL of the resource")
open var ImageUrl:Uri? = null
/**
* The Email of the resource
*/
@ApiMember(Description="The Email of the resource")
open var Email:String? = 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
/**
* If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved
*/
@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")
open var CustomFields:ArrayList<AddCustomField> = ArrayList<AddCustomField>()
}
open class AddCustomField
{
open var Id:Int? = null
open var Value:String? = 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 .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /resource/{Id} HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateResource 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>
<Color>String</Color>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<CustomFields>
<AddCustomField>
<Id>0</Id>
<Value>String</Value>
</AddCustomField>
</CustomFields>
<Description>String</Description>
<Email>String</Email>
<EmailNotification>false</EmailNotification>
<Id>0</Id>
<ImageUrl i:nil="true" />
<MobilePhone>String</MobilePhone>
<Name>String</Name>
<SMSNotification>false</SMSNotification>
<SendEmailReminder>false</SendEmailReminder>
<SendSMSReminder>false</SendSMSReminder>
</UpdateResource>
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>