| 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. |
|---|
"use strict";
export class TimeException {
/** @param {{Id?:number,IsRecurring?:boolean,IsBlock?:boolean,ReasonText?:string,ReasonTextPublic?:string,From?:string,To?:string,ResourceIds?:number[]}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description Time exception id */
Id;
/**
* @type {boolean}
* @description Indicates whether or not the time exception is recurring */
IsRecurring;
/**
* @type {boolean}
* @description Indicates whether the time exception is blocking the time or not */
IsBlock;
/**
* @type {string}
* @description The reason of the time exception, example: Vacation, doctors appointment, ... */
ReasonText;
/**
* @type {string}
* @description The public reason of the time exception, example: Vacation, doctors appointment, ... */
ReasonTextPublic;
/**
* @type {string}
* @description Time exception start */
From;
/**
* @type {string}
* @description Time exception end */
To;
/**
* @type {number[]}
* @description Resources that owns this exception */
ResourceIds = [];
}
/** @typedef {number} */
export var BookingStatusEnum;
(function (BookingStatusEnum) {
BookingStatusEnum[BookingStatusEnum["Booked"] = 1] = "Booked"
BookingStatusEnum[BookingStatusEnum["Unbooked"] = 2] = "Unbooked"
BookingStatusEnum[BookingStatusEnum["Reserved"] = 3] = "Reserved"
BookingStatusEnum[BookingStatusEnum["Canceled"] = 4] = "Canceled"
BookingStatusEnum[BookingStatusEnum["AwaitingPayment"] = 5] = "AwaitingPayment"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentNoTimeLimit"] = 6] = "AwaitingPaymentNoTimeLimit"
BookingStatusEnum[BookingStatusEnum["Payed"] = 7] = "Payed"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentRequestFromAdmin"] = 8] = "AwaitingPaymentRequestFromAdmin"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentFromProvider"] = 9] = "AwaitingPaymentFromProvider"
BookingStatusEnum[BookingStatusEnum["Invoiced"] = 10] = "Invoiced"
})(BookingStatusEnum || (BookingStatusEnum = {}));
export class BookedCustomer {
/** @param {{Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,FacebookUserName?:string,ImageUrl?:string,CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Firstname;
/** @type {string} */
Lastname;
/** @type {string} */
Email;
/** @type {string} */
Phone;
/** @type {string} */
FacebookUserName;
/** @type {string} */
ImageUrl;
/** @type {string} */
CorporateIdentityNumber;
/** @type {string} */
InvoiceAddress1;
/** @type {string} */
InvoiceAddress2;
/** @type {string} */
InvoiceCity;
/** @type {string} */
InvoicePostalCode;
/** @type {string} */
InvoiceCountryCode;
}
export class BookedTime {
/** @param {{Id?:number,ServiceId?:number,From?:string,To?:string,BookedSpots?:number,TotalSpots?:number,PauseAfterInMinutes?:number,StatusId?:number,Status?:BookingStatusEnum,Customer?:BookedCustomer}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description Booking id */
Id;
/**
* @type {number}
* @description The booked service */
ServiceId;
/**
* @type {string}
* @description Booking start */
From;
/**
* @type {string}
* @description Booking end */
To;
/**
* @type {number}
* @description Number of booked spots */
BookedSpots;
/**
* @type {number}
* @description Number of total spots for the service */
TotalSpots;
/**
* @type {number}
* @description The pause after the booking */
PauseAfterInMinutes;
/**
* @type {number}
* @description The booking status */
StatusId;
/** @type {BookingStatusEnum} */
Status;
/**
* @type {BookedCustomer}
* @description The customer the booking belongs to */
Customer;
}
export class ResourceQueryResponse {
/** @param {{Id?:number,Name?:string,Description?:string,Active?:boolean,Color?:string,Email?:string,ImageUrl?:string,MobilePhone?:string,AccessGroup?:string,EmailNotification?:boolean,SMSNotification?:boolean,SendEmailReminder?:boolean,SendSMSReminder?:boolean,Exceptions?:TimeException[],Bookings?:BookedTime[],Created?:string,Updated?:string,ResponseStatus?:ResponseStatus}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The resource id */
Id;
/**
* @type {string}
* @description The resource name */
Name;
/**
* @type {string}
* @description The resource description */
Description;
/**
* @type {boolean}
* @description If resource is active or not */
Active;
/**
* @type {string}
* @description The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue. */
Color;
/**
* @type {string}
* @description The Email of the resource */
Email;
/**
* @type {string}
* @description The Image URL of the resource */
ImageUrl;
/**
* @type {string}
* @description The Mobile phone number of the resource */
MobilePhone;
/**
* @type {string}
* @description Used by example code locks to know what access group the resource is assigned to */
AccessGroup;
/**
* @type {boolean}
* @description If the resource should receive Email notification when booked */
EmailNotification;
/**
* @type {boolean}
* @description If the resource should receive SMS notification when booked */
SMSNotification;
/**
* @type {?boolean}
* @description If the resource should receive Email reminders on bookings */
SendEmailReminder;
/**
* @type {?boolean}
* @description If the resource should receive SMS reminders on bookings */
SendSMSReminder;
/**
* @type {TimeException[]}
* @description The resource time exceptions */
Exceptions = [];
/**
* @type {BookedTime[]}
* @description The resource bookings */
Bookings = [];
/**
* @type {string}
* @description The date when the resource was created */
Created;
/**
* @type {string}
* @description The date when the resource was updated */
Updated;
/** @type {ResponseStatus} */
ResponseStatus;
}
export class AddCustomField {
/** @param {{Id?:number,Value?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Value;
}
export class UpdateResource {
/** @param {{CompanyId?:string,Id?:number,Name?:string,Description?:string,Active?:boolean,Color?:string,ImageUrl?:string,Email?:string,MobilePhone?:string,AccessGroup?:string,EmailNotification?:boolean,SMSNotification?:boolean,SendEmailReminder?:boolean,SendSMSReminder?:boolean,CustomFields?:AddCustomField[]}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description Enter the company id, if blank company id and you are an admin, your company id will be used. */
CompanyId;
/**
* @type {number}
* @description Id of the resource */
Id;
/**
* @type {string}
* @description The resource name */
Name;
/**
* @type {string}
* @description The resource description */
Description;
/**
* @type {?boolean}
* @description If resource is active or not */
Active;
/**
* @type {string}
* @description The resource color in scheduler */
Color;
/**
* @type {string}
* @description The Image URL of the resource */
ImageUrl;
/**
* @type {string}
* @description The Email of the resource */
Email;
/**
* @type {string}
* @description The Mobile phone number of the resource */
MobilePhone;
/**
* @type {string}
* @description Used by example code locks to know what access group the resource is assigned to */
AccessGroup;
/**
* @type {?boolean}
* @description If the resource should receive Email notification when booked */
EmailNotification;
/**
* @type {?boolean}
* @description If the resource should receive SMS notification when booked */
SMSNotification;
/**
* @type {?boolean}
* @description If the resource should receive Email reminders on bookings */
SendEmailReminder;
/**
* @type {?boolean}
* @description If the resource should receive SMS reminders on bookings */
SendSMSReminder;
/**
* @type {AddCustomField[]}
* @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 */
CustomFields = [];
}
JavaScript UpdateResource DTOs
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>