BokaMera.API.Host

<back to all web services

CreateResource

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/resourceAdd a new resourceAdd a new resource to the company of the currently logged in user, only administrators are allowed to add resources.
import java.math.*
import java.util.*
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)
@ValidateRequest(Validator="IsAuthenticated")
open class CreateResource : 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)
    var CompanyId:UUID? = null

    /**
    * The resource name
    */
    @ApiMember(Description="The resource name")
    var Name:String? = null

    /**
    * The resource description
    */
    @ApiMember(Description="The resource description")
    var Description:String? = null

    /**
    * If resource is active or not. Default is active.
    */
    @ApiMember(Description="If resource is active or not. Default is active.")
    var Active:Boolean? = null

    /**
    * The resource color in scheduler
    */
    @ApiMember(Description="The resource color in scheduler")
    var Color:String? = null

    /**
    * The email of the resource
    */
    @ApiMember(Description="The email of the resource")
    var Email:String? = null

    /**
    * The image url of the resource
    */
    @ApiMember(Description="The image url of the resource")
    var ImageUrl:Uri? = 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")
    var AccessGroup:String? = null

    /**
    * The mobile phone number of the resource
    */
    @ApiMember(Description="The mobile phone number of the resource")
    var MobilePhone:String? = null

    /**
    * If the resource should receive email notification when booked
    */
    @ApiMember(Description="If the resource should receive email notification when booked")
    var EmailNotification:Boolean? = null

    /**
    * If the resource should receive SMS notification when booked
    */
    @ApiMember(Description="If the resource should receive SMS notification when booked")
    var SMSNotification:Boolean? = null

    /**
    * If the resource should receive email reminders on bookings
    */
    @ApiMember(Description="If the resource should receive email reminders on bookings")
    var SendEmailReminder:Boolean? = null

    /**
    * If the resource should receive SMS reminders on bookings
    */
    @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    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")
    var CustomFields:ArrayList<AddCustomField> = ArrayList<AddCustomField>()
}

open class AddCustomField
{
    var Id:Int? = null
    var Value:String? = null
}

open class ResourceQueryResponse
{
    /**
    * The resource id
    */
    @ApiMember(Description="The resource id")
    var Id:Int? = null

    /**
    * The resource name
    */
    @ApiMember(Description="The resource name")
    var Name:String? = null

    /**
    * The resource description
    */
    @ApiMember(Description="The resource description")
    var Description:String? = null

    /**
    * If resource is active or not
    */
    @ApiMember(Description="If resource is active or not")
    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.")
    var Color:String? = null

    /**
    * The email of the resource
    */
    @ApiMember(Description="The email of the resource")
    var Email:String? = null

    /**
    * The image url of the resource
    */
    @ApiMember(Description="The image url of the resource")
    var ImageUrl:Uri? = null

    /**
    * The mobile phone number of the resource
    */
    @ApiMember(Description="The mobile phone number of the resource")
    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")
    var AccessGroup:String? = null

    /**
    * If the resource should receive email notification when booked
    */
    @ApiMember(Description="If the resource should receive email notification when booked")
    var EmailNotification:Boolean? = null

    /**
    * If the resource should receive SMS notification when booked
    */
    @ApiMember(Description="If the resource should receive SMS notification when booked")
    var SMSNotification:Boolean? = null

    /**
    * If the resource should receive email reminders on bookings
    */
    @ApiMember(Description="If the resource should receive email reminders on bookings")
    var SendEmailReminder:Boolean? = null

    /**
    * If the resource should receive SMS reminders on bookings
    */
    @ApiMember(Description="If the resource should receive SMS reminders on bookings")
    var SendSMSReminder:Boolean? = null

    /**
    * The resource time exceptions
    */
    @ApiMember(Description="The resource time exceptions")
    var Exceptions:ArrayList<TimeException> = ArrayList<TimeException>()

    /**
    * The resource bookings
    */
    @ApiMember(Description="The resource bookings")
    var Bookings:ArrayList<BookedTime> = ArrayList<BookedTime>()

    /**
    * Then date when the resource was created
    */
    @ApiMember(Description="Then date when the resource was created")
    var Created:Date? = null

    /**
    * Then date when the resource was updated
    */
    @ApiMember(Description="Then date when the resource was updated")
    var Updated:Date? = null

    var ResponseStatus:ResponseStatus? = null
}

open class TimeException : ITimeException
{
    /**
    * Time exception id
    */
    @ApiMember(Description="Time exception id")
    var Id:Int? = null

    /**
    * Indicates whether or not the time exception is recurring
    */
    @ApiMember(Description="Indicates whether or not the time exception is recurring")
    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")
    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, ...")
    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, ...")
    var ReasonTextPublic:String? = null

    /**
    * Time exception start
    */
    @ApiMember(Description="Time exception start")
    var From:Date? = null

    /**
    * Time exception end
    */
    @ApiMember(Description="Time exception end")
    var To:Date? = null

    /**
    * Resources that owns this exception
    */
    @ApiMember(Description="Resources that owns this exception")
    var ResourceIds:ArrayList<Int>? = null
}

open class BookedTime : IBookedTime
{
    /**
    * Booking id
    */
    @ApiMember(Description="Booking id")
    var Id:Int? = null

    /**
    * The booked service
    */
    @ApiMember(Description="The booked service")
    var ServiceId:Int? = null

    /**
    * Booking start
    */
    @ApiMember(Description="Booking start")
    var From:Date? = null

    /**
    * Booking end
    */
    @ApiMember(Description="Booking end")
    var To:Date? = null

    /**
    * Number of booked spots
    */
    @ApiMember(Description="Number of booked spots")
    var BookedSpots:Int? = null

    /**
    * Number of total spots for the service
    */
    @ApiMember(Description="Number of total spots for the service")
    var TotalSpots:Int? = null

    /**
    * The pause after the booking
    */
    @ApiMember(Description="The pause after the booking")
    var PauseAfterInMinutes:Int? = null

    /**
    * The booking status
    */
    @ApiMember(Description="The booking status")
    var StatusId:Int? = null

    var Status:BookingStatusEnum? = null
    /**
    * The customer the booking belongs to
    */
    @ApiMember(Description="The customer the booking belongs to")
    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
{
    var Id:UUID? = null
    var Firstname:String? = null
    var Lastname:String? = null
    var Email:String? = null
    var Phone:String? = null
    var FacebookUserName:String? = null
    var ImageUrl:String? = null
    var CorporateIdentityNumber:String? = null
    var InvoiceAddress1:String? = null
    var InvoiceAddress2:String? = null
    var InvoiceCity:String? = null
    var InvoicePostalCode:String? = null
    var InvoiceCountryCode:String? = null
}

Kotlin CreateResource DTOs

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

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /resource HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateResource 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>
  <ImageUrl i:nil="true" />
  <MobilePhone>String</MobilePhone>
  <Name>String</Name>
  <SMSNotification>false</SMSNotification>
  <SendEmailReminder>false</SendEmailReminder>
  <SendSMSReminder>false</SendSMSReminder>
</CreateResource>
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>