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 net.servicestack.client.*;
public class dtos
{
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@ValidateRequest(Validator="IsAuthenticated")
public static class UpdateResource implements 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)
public UUID CompanyId = null;
/**
* Id of the resource
*/
@ApiMember(Description="Id of the resource", IsRequired=true, ParameterType="path")
public Integer Id = null;
/**
* The resource name
*/
@ApiMember(Description="The resource name")
public String Name = null;
/**
* The resource description
*/
@ApiMember(Description="The resource description")
public String Description = null;
/**
* If resource is active or not
*/
@ApiMember(Description="If resource is active or not")
public Boolean Active = null;
/**
* The resource color in scheduler
*/
@ApiMember(Description="The resource color in scheduler")
public String Color = null;
/**
* The image url of the resource
*/
@ApiMember(Description="The image url of the resource")
public Uri ImageUrl = null;
/**
* The email of the resource
*/
@ApiMember(Description="The email of the resource")
public String Email = null;
/**
* The mobile phone number of the resource
*/
@ApiMember(Description="The mobile phone number of the resource")
public String MobilePhone = 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")
public String AccessGroup = null;
/**
* If the resource should receive email notification when booked
*/
@ApiMember(Description="If the resource should receive email notification when booked")
public Boolean EmailNotification = null;
/**
* If the resource should receive SMS notification when booked
*/
@ApiMember(Description="If the resource should receive SMS notification when booked")
public Boolean SMSNotification = null;
/**
* If the resource should receive email reminders on bookings
*/
@ApiMember(Description="If the resource should receive email reminders on bookings")
public Boolean SendEmailReminder = null;
/**
* If the resource should receive SMS reminders on bookings
*/
@ApiMember(Description="If the resource should receive SMS reminders on bookings")
public Boolean SendSMSReminder = 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")
public ArrayList<AddCustomField> CustomFields = null;
public UUID getCompanyId() { return CompanyId; }
public UpdateResource setCompanyId(UUID value) { this.CompanyId = value; return this; }
public Integer getId() { return Id; }
public UpdateResource setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public UpdateResource setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public UpdateResource setDescription(String value) { this.Description = value; return this; }
public Boolean isActive() { return Active; }
public UpdateResource setActive(Boolean value) { this.Active = value; return this; }
public String getColor() { return Color; }
public UpdateResource setColor(String value) { this.Color = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public UpdateResource setImageUrl(Uri value) { this.ImageUrl = value; return this; }
public String getEmail() { return Email; }
public UpdateResource setEmail(String value) { this.Email = value; return this; }
public String getMobilePhone() { return MobilePhone; }
public UpdateResource setMobilePhone(String value) { this.MobilePhone = value; return this; }
public String getAccessGroup() { return AccessGroup; }
public UpdateResource setAccessGroup(String value) { this.AccessGroup = value; return this; }
public Boolean isEmailNotification() { return EmailNotification; }
public UpdateResource setEmailNotification(Boolean value) { this.EmailNotification = value; return this; }
public Boolean isSmsNotification() { return SMSNotification; }
public UpdateResource setSmsNotification(Boolean value) { this.SMSNotification = value; return this; }
public Boolean isSendEmailReminder() { return SendEmailReminder; }
public UpdateResource setSendEmailReminder(Boolean value) { this.SendEmailReminder = value; return this; }
public Boolean isSendSMSReminder() { return SendSMSReminder; }
public UpdateResource setSendSMSReminder(Boolean value) { this.SendSMSReminder = value; return this; }
public ArrayList<AddCustomField> getCustomFields() { return CustomFields; }
public UpdateResource setCustomFields(ArrayList<AddCustomField> value) { this.CustomFields = value; return this; }
}
public static class AddCustomField
{
public Integer Id = null;
public String Value = null;
public Integer getId() { return Id; }
public AddCustomField setId(Integer value) { this.Id = value; return this; }
public String getValue() { return Value; }
public AddCustomField setValue(String value) { this.Value = value; return this; }
}
public static class ResourceQueryResponse
{
/**
* The resource id
*/
@ApiMember(Description="The resource id")
public Integer Id = null;
/**
* The resource name
*/
@ApiMember(Description="The resource name")
public String Name = null;
/**
* The resource description
*/
@ApiMember(Description="The resource description")
public String Description = null;
/**
* If resource is active or not
*/
@ApiMember(Description="If resource is active or not")
public Boolean Active = 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.")
public String Color = null;
/**
* The email of the resource
*/
@ApiMember(Description="The email of the resource")
public String Email = null;
/**
* The image url of the resource
*/
@ApiMember(Description="The image url of the resource")
public Uri ImageUrl = null;
/**
* The mobile phone number of the resource
*/
@ApiMember(Description="The mobile phone number of the resource")
public String MobilePhone = 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")
public String AccessGroup = null;
/**
* If the resource should receive email notification when booked
*/
@ApiMember(Description="If the resource should receive email notification when booked")
public Boolean EmailNotification = null;
/**
* If the resource should receive SMS notification when booked
*/
@ApiMember(Description="If the resource should receive SMS notification when booked")
public Boolean SMSNotification = null;
/**
* If the resource should receive email reminders on bookings
*/
@ApiMember(Description="If the resource should receive email reminders on bookings")
public Boolean SendEmailReminder = null;
/**
* If the resource should receive SMS reminders on bookings
*/
@ApiMember(Description="If the resource should receive SMS reminders on bookings")
public Boolean SendSMSReminder = null;
/**
* The resource time exceptions
*/
@ApiMember(Description="The resource time exceptions")
public ArrayList<TimeException> Exceptions = null;
/**
* The resource bookings
*/
@ApiMember(Description="The resource bookings")
public ArrayList<BookedTime> Bookings = null;
/**
* Then date when the resource was created
*/
@ApiMember(Description="Then date when the resource was created")
public Date Created = null;
/**
* Then date when the resource was updated
*/
@ApiMember(Description="Then date when the resource was updated")
public Date Updated = null;
public ResponseStatus ResponseStatus = null;
public Integer getId() { return Id; }
public ResourceQueryResponse setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public ResourceQueryResponse setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public ResourceQueryResponse setDescription(String value) { this.Description = value; return this; }
public Boolean isActive() { return Active; }
public ResourceQueryResponse setActive(Boolean value) { this.Active = value; return this; }
public String getColor() { return Color; }
public ResourceQueryResponse setColor(String value) { this.Color = value; return this; }
public String getEmail() { return Email; }
public ResourceQueryResponse setEmail(String value) { this.Email = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public ResourceQueryResponse setImageUrl(Uri value) { this.ImageUrl = value; return this; }
public String getMobilePhone() { return MobilePhone; }
public ResourceQueryResponse setMobilePhone(String value) { this.MobilePhone = value; return this; }
public String getAccessGroup() { return AccessGroup; }
public ResourceQueryResponse setAccessGroup(String value) { this.AccessGroup = value; return this; }
public Boolean isEmailNotification() { return EmailNotification; }
public ResourceQueryResponse setEmailNotification(Boolean value) { this.EmailNotification = value; return this; }
public Boolean isSmsNotification() { return SMSNotification; }
public ResourceQueryResponse setSmsNotification(Boolean value) { this.SMSNotification = value; return this; }
public Boolean isSendEmailReminder() { return SendEmailReminder; }
public ResourceQueryResponse setSendEmailReminder(Boolean value) { this.SendEmailReminder = value; return this; }
public Boolean isSendSMSReminder() { return SendSMSReminder; }
public ResourceQueryResponse setSendSMSReminder(Boolean value) { this.SendSMSReminder = value; return this; }
public ArrayList<TimeException> getExceptions() { return Exceptions; }
public ResourceQueryResponse setExceptions(ArrayList<TimeException> value) { this.Exceptions = value; return this; }
public ArrayList<BookedTime> getBookings() { return Bookings; }
public ResourceQueryResponse setBookings(ArrayList<BookedTime> value) { this.Bookings = value; return this; }
public Date getCreated() { return Created; }
public ResourceQueryResponse setCreated(Date value) { this.Created = value; return this; }
public Date getUpdated() { return Updated; }
public ResourceQueryResponse setUpdated(Date value) { this.Updated = value; return this; }
public ResponseStatus getResponseStatus() { return ResponseStatus; }
public ResourceQueryResponse setResponseStatus(ResponseStatus value) { this.ResponseStatus = value; return this; }
}
public static class TimeException implements ITimeException
{
/**
* Time exception id
*/
@ApiMember(Description="Time exception id")
public Integer Id = null;
/**
* Indicates whether or not the time exception is recurring
*/
@ApiMember(Description="Indicates whether or not the time exception is recurring")
public Boolean IsRecurring = 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")
public Boolean IsBlock = null;
/**
* The reason of the time exception, example: Vacation, doctors appointment, ...
*/
@ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
public String ReasonText = 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, ...")
public String ReasonTextPublic = null;
/**
* Time exception start
*/
@ApiMember(Description="Time exception start")
public Date From = null;
/**
* Time exception end
*/
@ApiMember(Description="Time exception end")
public Date To = null;
/**
* Resources that owns this exception
*/
@ApiMember(Description="Resources that owns this exception")
public ArrayList<Integer> ResourceIds = null;
public Integer getId() { return Id; }
public TimeException setId(Integer value) { this.Id = value; return this; }
public Boolean getIsRecurring() { return IsRecurring; }
public TimeException setIsRecurring(Boolean value) { this.IsRecurring = value; return this; }
public Boolean getIsBlock() { return IsBlock; }
public TimeException setIsBlock(Boolean value) { this.IsBlock = value; return this; }
public String getReasonText() { return ReasonText; }
public TimeException setReasonText(String value) { this.ReasonText = value; return this; }
public String getReasonTextPublic() { return ReasonTextPublic; }
public TimeException setReasonTextPublic(String value) { this.ReasonTextPublic = value; return this; }
public Date getFrom() { return From; }
public TimeException setFrom(Date value) { this.From = value; return this; }
public Date getTo() { return To; }
public TimeException setTo(Date value) { this.To = value; return this; }
public ArrayList<Integer> getResourceIds() { return ResourceIds; }
public TimeException setResourceIds(ArrayList<Integer> value) { this.ResourceIds = value; return this; }
}
public static class BookedTime implements IBookedTime
{
/**
* Booking id
*/
@ApiMember(Description="Booking id")
public Integer Id = null;
/**
* The booked service
*/
@ApiMember(Description="The booked service")
public Integer ServiceId = null;
/**
* Booking start
*/
@ApiMember(Description="Booking start")
public Date From = null;
/**
* Booking end
*/
@ApiMember(Description="Booking end")
public Date To = null;
/**
* Number of booked spots
*/
@ApiMember(Description="Number of booked spots")
public Integer BookedSpots = null;
/**
* Number of total spots for the service
*/
@ApiMember(Description="Number of total spots for the service")
public Integer TotalSpots = null;
/**
* The pause after the booking
*/
@ApiMember(Description="The pause after the booking")
public Integer PauseAfterInMinutes = null;
/**
* The booking status
*/
@ApiMember(Description="The booking status")
public Integer StatusId = null;
public BookingStatusEnum Status = null;
/**
* The customer the booking belongs to
*/
@ApiMember(Description="The customer the booking belongs to")
public BookedCustomer Customer = null;
public Integer getId() { return Id; }
public BookedTime setId(Integer value) { this.Id = value; return this; }
public Integer getServiceId() { return ServiceId; }
public BookedTime setServiceId(Integer value) { this.ServiceId = value; return this; }
public Date getFrom() { return From; }
public BookedTime setFrom(Date value) { this.From = value; return this; }
public Date getTo() { return To; }
public BookedTime setTo(Date value) { this.To = value; return this; }
public Integer getBookedSpots() { return BookedSpots; }
public BookedTime setBookedSpots(Integer value) { this.BookedSpots = value; return this; }
public Integer getTotalSpots() { return TotalSpots; }
public BookedTime setTotalSpots(Integer value) { this.TotalSpots = value; return this; }
public Integer getPauseAfterInMinutes() { return PauseAfterInMinutes; }
public BookedTime setPauseAfterInMinutes(Integer value) { this.PauseAfterInMinutes = value; return this; }
public Integer getStatusId() { return StatusId; }
public BookedTime setStatusId(Integer value) { this.StatusId = value; return this; }
public BookingStatusEnum getStatus() { return Status; }
public BookedTime setStatus(BookingStatusEnum value) { this.Status = value; return this; }
public BookedCustomer getCustomer() { return Customer; }
public BookedTime setCustomer(BookedCustomer value) { this.Customer = value; return this; }
}
public static enum BookingStatusEnum
{
Booked(1),
Unbooked(2),
Reserved(3),
Canceled(4),
AwaitingPayment(5),
AwaitingPaymentNoTimeLimit(6),
Payed(7),
AwaitingPaymentRequestFromAdmin(8),
AwaitingPaymentFromProvider(9),
Invoiced(10);
private final int value;
BookingStatusEnum(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class BookedCustomer
{
public UUID Id = null;
public String Firstname = null;
public String Lastname = null;
public String Email = null;
public String Phone = null;
public String FacebookUserName = null;
public String ImageUrl = null;
public String CorporateIdentityNumber = null;
public String InvoiceAddress1 = null;
public String InvoiceAddress2 = null;
public String InvoiceCity = null;
public String InvoicePostalCode = null;
public String InvoiceCountryCode = null;
public UUID getId() { return Id; }
public BookedCustomer setId(UUID value) { this.Id = value; return this; }
public String getFirstname() { return Firstname; }
public BookedCustomer setFirstname(String value) { this.Firstname = value; return this; }
public String getLastname() { return Lastname; }
public BookedCustomer setLastname(String value) { this.Lastname = value; return this; }
public String getEmail() { return Email; }
public BookedCustomer setEmail(String value) { this.Email = value; return this; }
public String getPhone() { return Phone; }
public BookedCustomer setPhone(String value) { this.Phone = value; return this; }
public String getFacebookUserName() { return FacebookUserName; }
public BookedCustomer setFacebookUserName(String value) { this.FacebookUserName = value; return this; }
public String getImageUrl() { return ImageUrl; }
public BookedCustomer setImageUrl(String value) { this.ImageUrl = value; return this; }
public String getCorporateIdentityNumber() { return CorporateIdentityNumber; }
public BookedCustomer setCorporateIdentityNumber(String value) { this.CorporateIdentityNumber = value; return this; }
public String getInvoiceAddress1() { return InvoiceAddress1; }
public BookedCustomer setInvoiceAddress1(String value) { this.InvoiceAddress1 = value; return this; }
public String getInvoiceAddress2() { return InvoiceAddress2; }
public BookedCustomer setInvoiceAddress2(String value) { this.InvoiceAddress2 = value; return this; }
public String getInvoiceCity() { return InvoiceCity; }
public BookedCustomer setInvoiceCity(String value) { this.InvoiceCity = value; return this; }
public String getInvoicePostalCode() { return InvoicePostalCode; }
public BookedCustomer setInvoicePostalCode(String value) { this.InvoicePostalCode = value; return this; }
public String getInvoiceCountryCode() { return InvoiceCountryCode; }
public BookedCustomer setInvoiceCountryCode(String value) { this.InvoiceCountryCode = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","MobilePhone":"String","AccessGroup":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"CustomFields":[{"Id":0,"Value":"String"}]}
HTTP/1.1 200 OK Content-Type: text/csv 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"}}}