BokaMera.API.Host

<back to all web services

UpdateResource

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/resource/{Id}Update existing resourceUpdates an existing resource if you are authorized to do so.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
using BokaMera.API.ServiceModel.Enums;

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class AddCustomField
    {
        public virtual int Id { get; set; }
        public virtual string Value { get; set; }
    }

    public partial class BookedCustomer
    {
        public virtual Guid Id { get; set; }
        public virtual string Firstname { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Email { get; set; }
        public virtual string Phone { get; set; }
        public virtual string FacebookUserName { get; set; }
        public virtual string ImageUrl { get; set; }
        public virtual string CorporateIdentityNumber { get; set; }
        public virtual string InvoiceAddress1 { get; set; }
        public virtual string InvoiceAddress2 { get; set; }
        public virtual string InvoiceCity { get; set; }
        public virtual string InvoicePostalCode { get; set; }
        public virtual string InvoiceCountryCode { get; set; }
    }

    public partial class BookedTime
        : IBookedTime
    {
        ///<summary>
        ///Booking id
        ///</summary>
        [ApiMember(Description="Booking id")]
        public virtual int Id { get; set; }

        ///<summary>
        ///The booked service
        ///</summary>
        [ApiMember(Description="The booked service")]
        public virtual int ServiceId { get; set; }

        ///<summary>
        ///Booking start
        ///</summary>
        [ApiMember(Description="Booking start")]
        public virtual DateTime From { get; set; }

        ///<summary>
        ///Booking end
        ///</summary>
        [ApiMember(Description="Booking end")]
        public virtual DateTime To { get; set; }

        ///<summary>
        ///Number of booked spots
        ///</summary>
        [ApiMember(Description="Number of booked spots")]
        public virtual int BookedSpots { get; set; }

        ///<summary>
        ///Number of total spots for the service
        ///</summary>
        [ApiMember(Description="Number of total spots for the service")]
        public virtual int TotalSpots { get; set; }

        ///<summary>
        ///The pause after the booking
        ///</summary>
        [ApiMember(Description="The pause after the booking")]
        public virtual int PauseAfterInMinutes { get; set; }

        ///<summary>
        ///The booking status
        ///</summary>
        [ApiMember(Description="The booking status")]
        public virtual int StatusId { get; set; }

        public virtual BookingStatusEnum Status { get; set; }
        ///<summary>
        ///The customer the booking belongs to
        ///</summary>
        [ApiMember(Description="The customer the booking belongs to")]
        public virtual BookedCustomer Customer { get; set; }
    }

    public partial class ResourceQueryResponse
    {
        public ResourceQueryResponse()
        {
            Exceptions = new List<TimeException>{};
            Bookings = new List<BookedTime>{};
        }

        ///<summary>
        ///The resource id
        ///</summary>
        [ApiMember(Description="The resource id")]
        public virtual int Id { get; set; }

        ///<summary>
        ///The resource name
        ///</summary>
        [ApiMember(Description="The resource name")]
        public virtual string Name { get; set; }

        ///<summary>
        ///The resource description
        ///</summary>
        [ApiMember(Description="The resource description")]
        public virtual string Description { get; set; }

        ///<summary>
        ///If resource is active or not
        ///</summary>
        [ApiMember(Description="If resource is active or not")]
        public virtual bool Active { get; set; }

        ///<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 virtual string Color { get; set; }

        ///<summary>
        ///The email of the resource
        ///</summary>
        [ApiMember(Description="The email of the resource")]
        public virtual string Email { get; set; }

        ///<summary>
        ///The image url of the resource
        ///</summary>
        [ApiMember(Description="The image url of the resource")]
        public virtual Uri ImageUrl { get; set; }

        ///<summary>
        ///The mobile phone number of the resource
        ///</summary>
        [ApiMember(Description="The mobile phone number of the resource")]
        public virtual string MobilePhone { get; set; }

        ///<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 virtual string AccessGroup { get; set; }

        ///<summary>
        ///If the resource should receive email notification when booked
        ///</summary>
        [ApiMember(Description="If the resource should receive email notification when booked")]
        public virtual bool EmailNotification { get; set; }

        ///<summary>
        ///If the resource should receive SMS notification when booked
        ///</summary>
        [ApiMember(Description="If the resource should receive SMS notification when booked")]
        public virtual bool SMSNotification { get; set; }

        ///<summary>
        ///If the resource should receive email reminders on bookings
        ///</summary>
        [ApiMember(Description="If the resource should receive email reminders on bookings")]
        public virtual bool? SendEmailReminder { get; set; }

        ///<summary>
        ///If the resource should receive SMS reminders on bookings
        ///</summary>
        [ApiMember(Description="If the resource should receive SMS reminders on bookings")]
        public virtual bool? SendSMSReminder { get; set; }

        ///<summary>
        ///The resource time exceptions
        ///</summary>
        [ApiMember(Description="The resource time exceptions")]
        public virtual List<TimeException> Exceptions { get; set; }

        ///<summary>
        ///The resource bookings
        ///</summary>
        [ApiMember(Description="The resource bookings")]
        public virtual List<BookedTime> Bookings { get; set; }

        ///<summary>
        ///Then date when the resource was created
        ///</summary>
        [ApiMember(Description="Then date when the resource was created")]
        public virtual DateTime Created { get; set; }

        ///<summary>
        ///Then date when the resource was updated
        ///</summary>
        [ApiMember(Description="Then date when the resource was updated")]
        public virtual DateTime Updated { get; set; }

        public virtual ResponseStatus ResponseStatus { get; set; }
    }

    public partial class TimeException
        : ITimeException
    {
        public TimeException()
        {
            ResourceIds = new int[]{};
        }

        ///<summary>
        ///Time exception id
        ///</summary>
        [ApiMember(Description="Time exception id")]
        public virtual int Id { get; set; }

        ///<summary>
        ///Indicates whether or not the time exception is recurring
        ///</summary>
        [ApiMember(Description="Indicates whether or not the time exception is recurring")]
        public virtual bool IsRecurring { get; set; }

        ///<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 virtual bool IsBlock { get; set; }

        ///<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 virtual string ReasonText { get; set; }

        ///<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 virtual string ReasonTextPublic { get; set; }

        ///<summary>
        ///Time exception start
        ///</summary>
        [ApiMember(Description="Time exception start")]
        public virtual DateTime From { get; set; }

        ///<summary>
        ///Time exception end
        ///</summary>
        [ApiMember(Description="Time exception end")]
        public virtual DateTime To { get; set; }

        ///<summary>
        ///Resources that owns this exception
        ///</summary>
        [ApiMember(Description="Resources that owns this exception")]
        public virtual int[] ResourceIds { get; set; }
    }

    [ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
    [ValidateRequest("IsAuthenticated")]
    public partial class UpdateResource
        : ICompany
    {
        public UpdateResource()
        {
            CustomFields = new List<AddCustomField>{};
        }

        ///<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 virtual Guid? CompanyId { get; set; }

        ///<summary>
        ///Id of the resource
        ///</summary>
        [ApiMember(Description="Id of the resource", IsRequired=true, ParameterType="path")]
        public virtual int Id { get; set; }

        ///<summary>
        ///The resource name
        ///</summary>
        [ApiMember(Description="The resource name")]
        public virtual string Name { get; set; }

        ///<summary>
        ///The resource description
        ///</summary>
        [ApiMember(Description="The resource description")]
        public virtual string Description { get; set; }

        ///<summary>
        ///If resource is active or not
        ///</summary>
        [ApiMember(Description="If resource is active or not")]
        public virtual bool? Active { get; set; }

        ///<summary>
        ///The resource color in scheduler
        ///</summary>
        [ApiMember(Description="The resource color in scheduler")]
        public virtual string Color { get; set; }

        ///<summary>
        ///The image url of the resource
        ///</summary>
        [ApiMember(Description="The image url of the resource")]
        public virtual Uri ImageUrl { get; set; }

        ///<summary>
        ///The email of the resource
        ///</summary>
        [ApiMember(Description="The email of the resource")]
        public virtual string Email { get; set; }

        ///<summary>
        ///The mobile phone number of the resource
        ///</summary>
        [ApiMember(Description="The mobile phone number of the resource")]
        public virtual string MobilePhone { get; set; }

        ///<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 virtual string AccessGroup { get; set; }

        ///<summary>
        ///If the resource should receive email notification when booked
        ///</summary>
        [ApiMember(Description="If the resource should receive email notification when booked")]
        public virtual bool? EmailNotification { get; set; }

        ///<summary>
        ///If the resource should receive SMS notification when booked
        ///</summary>
        [ApiMember(Description="If the resource should receive SMS notification when booked")]
        public virtual bool? SMSNotification { get; set; }

        ///<summary>
        ///If the resource should receive email reminders on bookings
        ///</summary>
        [ApiMember(Description="If the resource should receive email reminders on bookings")]
        public virtual bool? SendEmailReminder { get; set; }

        ///<summary>
        ///If the resource should receive SMS reminders on bookings
        ///</summary>
        [ApiMember(Description="If the resource should receive SMS reminders on bookings")]
        public virtual bool? SendSMSReminder { get; set; }

        ///<summary>
        ///If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved
        ///</summary>
        [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 virtual List<AddCustomField> CustomFields { get; set; }
    }

}

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,
    }

}

C# UpdateResource DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

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: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
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/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
		}
	}
}