BokaMera.API.Host

<back to all web services

CreateResourceType

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/resourcetypesAdd a new resourcetypeAdd a new resourcetype to the company of the currently logged in user, only administrators are allowed to add resourcetypes.
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BokaMera.API.ServiceModel.Dtos

Namespace Global

    Namespace BokaMera.API.ServiceModel.Dtos

        Public Partial Class AddResourceTypeResource
            '''<Summary>
            '''The resource id
            '''</Summary>
            <ApiMember(Description:="The resource id")>
            Public Overridable Property Id As Integer

            '''<Summary>
            '''The priority of the resource. If no priority is set it will take random resource when booking a time.
            '''</Summary>
            <ApiMember(Description:="The priority of the resource. If no priority is set it will take random resource when booking a time.")>
            Public Overridable Property Priority As Integer
        End Class

        <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")>
        Public Partial Class CreateResourceType
            Implements ICompany
            Public Sub New()
                Resources = New List(Of AddResourceTypeResource)
            End Sub

            '''<Summary>
            '''The company id, if empty will use the company id for the user you are logged in with.
            '''</Summary>
            <ApiMember(Description:="The company id, if empty will use the company id for the user you are logged in with.")>
            Public Overridable Property CompanyId As Nullable(Of Guid)

            '''<Summary>
            '''The resourcetype name
            '''</Summary>
            <ApiMember(Description:="The resourcetype name")>
            Public Overridable Property Name As String

            '''<Summary>
            '''The resources to be included
            '''</Summary>
            <ApiMember(Description:="The resources to be included")>
            Public Overridable Property Resources As List(Of AddResourceTypeResource)

            '''<Summary>
            '''The resourcetype description
            '''</Summary>
            <ApiMember(Description:="The resourcetype description")>
            Public Overridable Property Description As String

            '''<Summary>
            '''If resourcetype is active or not
            '''</Summary>
            <ApiMember(Description:="If resourcetype is active or not")>
            Public Overridable Property Active As Boolean
        End Class

        Public Partial Class ResourceTypeQueryResponse
            Public Sub New()
                Resources = New List(Of ResourceTypeResource)
            End Sub

            '''<Summary>
            '''The resourcetype id
            '''</Summary>
            <ApiMember(Description:="The resourcetype id")>
            Public Overridable Property Id As Integer

            '''<Summary>
            '''The resourcetype name
            '''</Summary>
            <ApiMember(Description:="The resourcetype name")>
            Public Overridable Property Name As String

            '''<Summary>
            '''The resourcetype description
            '''</Summary>
            <ApiMember(Description:="The resourcetype description")>
            Public Overridable Property Description As String

            '''<Summary>
            '''The resources in the resourcetype. Only shows active resources if not admin.
            '''</Summary>
            <ApiMember(Description:="The resources in the resourcetype. Only shows active resources if not admin.")>
            Public Overridable Property Resources As List(Of ResourceTypeResource)

            '''<Summary>
            '''If resourcetype is active or not
            '''</Summary>
            <ApiMember(Description:="If resourcetype is active or not")>
            Public Overridable Property Active As Boolean

            '''<Summary>
            '''Then date when the resource was created
            '''</Summary>
            <ApiMember(Description:="Then date when the resource was created")>
            Public Overridable Property Created As Date

            '''<Summary>
            '''Then date when the resource was updated
            '''</Summary>
            <ApiMember(Description:="Then date when the resource was updated")>
            Public Overridable Property Updated As Date
        End Class

        Public Partial Class ResourceTypeResource
            '''<Summary>
            '''The resource id
            '''</Summary>
            <ApiMember(Description:="The resource id")>
            Public Overridable Property Id As Integer

            '''<Summary>
            '''The resource name
            '''</Summary>
            <ApiMember(Description:="The resource name")>
            Public Overridable Property Name As String

            '''<Summary>
            '''The resource status
            '''</Summary>
            <ApiMember(Description:="The resource status")>
            Public Overridable Property Active As Boolean

            '''<Summary>
            '''The resource description
            '''</Summary>
            <ApiMember(Description:="The resource description")>
            Public Overridable Property Description As String

            '''<Summary>
            '''The resource email
            '''</Summary>
            <ApiMember(Description:="The resource email")>
            Public Overridable Property Email As String

            '''<Summary>
            '''The resource phone
            '''</Summary>
            <ApiMember(Description:="The resource phone")>
            Public Overridable Property Phone As String

            '''<Summary>
            '''The resource color
            '''</Summary>
            <ApiMember(Description:="The resource color")>
            Public Overridable Property Color As String

            '''<Summary>
            '''The resource image
            '''</Summary>
            <ApiMember(Description:="The resource image")>
            Public Overridable Property ImageUrl As Uri

            '''<Summary>
            '''The priority of the resource
            '''</Summary>
            <ApiMember(Description:="The priority of the resource")>
            Public Overridable Property Priority As Integer

            '''<Summary>
            '''If the resource want to receive email notifications
            '''</Summary>
            <ApiMember(Description:="If the resource want to receive email notifications")>
            Public Overridable Property EmailNotification As Boolean

            '''<Summary>
            '''If the resource want to receive sms notifications
            '''</Summary>
            <ApiMember(Description:="If the resource want to receive sms notifications")>
            Public Overridable Property SMSNotification As Boolean

            '''<Summary>
            '''If the resource want to receive email reminders
            '''</Summary>
            <ApiMember(Description:="If the resource want to receive email reminders")>
            Public Overridable Property EmailReminder As Boolean

            '''<Summary>
            '''If the resource want to receive sms reminders
            '''</Summary>
            <ApiMember(Description:="If the resource want to receive sms reminders")>
            Public Overridable Property SMSReminder As Boolean
        End Class
    End Namespace
End Namespace

VB.NET CreateResourceType 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.

POST /resourcetypes HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Name: String,
	Resources: 
	[
		{
			Id: 0,
			Priority: 0
		}
	],
	Description: String,
	Active: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Name: String,
	Description: String,
	Resources: 
	[
		{
			Id: 0,
			Name: String,
			Active: False,
			Description: String,
			Email: String,
			Phone: String,
			Color: String,
			Priority: 0,
			EmailNotification: False,
			SMSNotification: False,
			EmailReminder: False,
			SMSReminder: False
		}
	],
	Active: False
}