BokaMera.API.Host

<back to all web services

CreateCompanyUser

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/administrators/Add a new administrator to your companyIf you want to add a new administrator to your company. A generated password will be sent to the user.
import Foundation
import ServiceStack

// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class CreateCompanyUser : ICompany, Codable
{
    /**
    * Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.
    */
    // @ApiMember(Description="Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.", ParameterType="query")
    public var companyId:String?

    // @ApiMember(IsRequired=true)
    public var firstname:String

    // @ApiMember(IsRequired=true)
    public var lastname:String

    // @ApiMember(IsRequired=true)
    public var phone:String

    // @ApiMember(IsRequired=true)
    public var email:String

    // @ApiMember()
    public var resourceId:Int?

    // @ApiMember()
    public var roles:[AddCompanyUserRolesResponse] = []

    // @ApiMember()
    public var workerId:Int?

    required public init(){}
}

public class AddCompanyUserRolesResponse : Codable
{
    public var roleId:String

    required public init(){}
}

public class CompanyUserQueryResponse : Codable
{
    public var id:String
    public var companyId:String
    public var firstname:String
    public var lastname:String
    public var email:String
    public var phone:String
    public var workerId:String
    public var resourceId:Int?
    /**
    * The resource information connected to the administrator.
    */
    // @ApiMember(Description="The resource information connected to the administrator.")
    public var resource:CompanyUserResource

    /**
    * The roles that are connected to the administrator.
    */
    // @ApiMember(Description="The roles that are connected to the administrator.")
    public var roles:[CompanyUserRolesQueryResponse] = []

    public var active:Bool
    public var created:Date
    public var updated:Date

    required public init(){}
}

public class CompanyUserResource : Codable
{
    /**
    * The resource id
    */
    // @ApiMember(Description="The resource id")
    public var id:Int

    /**
    * The resource name
    */
    // @ApiMember(Description="The resource name")
    public var name:String

    /**
    * The resource status
    */
    // @ApiMember(Description="The resource status")
    public var active:Bool

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

    /**
    * The resource email
    */
    // @ApiMember(Description="The resource email")
    public var email:String

    /**
    * The resource phone
    */
    // @ApiMember(Description="The resource phone")
    public var phone:String

    /**
    * The resource color
    */
    // @ApiMember(Description="The resource color")
    public var color:String

    /**
    * The resource image
    */
    // @ApiMember(Description="The resource image")
    public var imageUrl:Uri

    /**
    * If the resource want to receive email notifications
    */
    // @ApiMember(Description="If the resource want to receive email notifications")
    public var emailNotification:Bool

    /**
    * If the resource want to receive sms notifications
    */
    // @ApiMember(Description="If the resource want to receive sms notifications")
    public var smsNotification:Bool

    /**
    * If the resource want to receive email reminders
    */
    // @ApiMember(Description="If the resource want to receive email reminders")
    public var emailReminder:Bool

    /**
    * If the resource want to receive sms reminders
    */
    // @ApiMember(Description="If the resource want to receive sms reminders")
    public var smsReminder:Bool

    required public init(){}
}

public class CompanyUserRolesQueryResponse : Codable
{
    public var roleId:String
    public var name:String
    public var Description:String

    required public init(){}
}


Swift CreateCompanyUser 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 /administrators/ HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Firstname: String,
	Lastname: String,
	Phone: String,
	Email: String,
	ResourceId: 0,
	Roles: 
	[
		{
			
		}
	],
	WorkerId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Firstname: String,
	Lastname: String,
	Email: String,
	Phone: String,
	WorkerId: String,
	ResourceId: 0,
	Resource: 
	{
		Id: 0,
		Name: String,
		Active: False,
		Description: String,
		Email: String,
		Phone: String,
		Color: String,
		EmailNotification: False,
		SMSNotification: False,
		EmailReminder: False,
		SMSReminder: False
	},
	Roles: 
	[
		{
			Name: String,
			Description: String
		}
	],
	Active: False
}