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.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class AddCompanyUserRolesResponse
    {
        public virtual Guid RoleId { get; set; }
    }

    public partial class CompanyUserQueryResponse
    {
        public CompanyUserQueryResponse()
        {
            Roles = new List<CompanyUserRolesQueryResponse>{};
        }

        public virtual Guid Id { get; set; }
        public virtual Guid CompanyId { 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 WorkerId { get; set; }
        public virtual int? ResourceId { get; set; }
        ///<summary>
        ///The resource information connected to the administrator.
        ///</summary>
        [ApiMember(Description="The resource information connected to the administrator.")]
        public virtual CompanyUserResource Resource { get; set; }

        ///<summary>
        ///The roles that are connected to the administrator.
        ///</summary>
        [ApiMember(Description="The roles that are connected to the administrator.")]
        public virtual List<CompanyUserRolesQueryResponse> Roles { get; set; }

        public virtual bool Active { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual DateTime Updated { get; set; }
    }

    public partial class CompanyUserResource
    {
        ///<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 status
        ///</summary>
        [ApiMember(Description="The resource status")]
        public virtual bool Active { get; set; }

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

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

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

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

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

        ///<summary>
        ///If the resource want to receive email notifications
        ///</summary>
        [ApiMember(Description="If the resource want to receive email notifications")]
        public virtual bool EmailNotification { get; set; }

        ///<summary>
        ///If the resource want to receive sms notifications
        ///</summary>
        [ApiMember(Description="If the resource want to receive sms notifications")]
        public virtual bool SMSNotification { get; set; }

        ///<summary>
        ///If the resource want to receive email reminders
        ///</summary>
        [ApiMember(Description="If the resource want to receive email reminders")]
        public virtual bool EmailReminder { get; set; }

        ///<summary>
        ///If the resource want to receive sms reminders
        ///</summary>
        [ApiMember(Description="If the resource want to receive sms reminders")]
        public virtual bool SMSReminder { get; set; }
    }

    public partial class CompanyUserRolesQueryResponse
    {
        public virtual Guid RoleId { get; set; }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
    }

    [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("IsAuthenticated")]
    public partial class CreateCompanyUser
        : ICompany
    {
        public CreateCompanyUser()
        {
            Roles = new List<AddCompanyUserRolesResponse>{};
        }

        ///<summary>
        ///Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.
        ///</summary>
        [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 virtual Guid? CompanyId { get; set; }

        [ApiMember(IsRequired=true)]
        public virtual string Firstname { get; set; }

        [ApiMember(IsRequired=true)]
        public virtual string Lastname { get; set; }

        [ApiMember(IsRequired=true)]
        public virtual string Phone { get; set; }

        [ApiMember(IsRequired=true)]
        public virtual string Email { get; set; }

        [ApiMember]
        public virtual int? ResourceId { get; set; }

        [ApiMember]
        public virtual List<AddCompanyUserRolesResponse> Roles { get; set; }

        [ApiMember]
        public virtual int? WorkerId { get; set; }
    }

}

C# CreateCompanyUser 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 /administrators/ HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateCompanyUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Email>String</Email>
  <Firstname>String</Firstname>
  <Lastname>String</Lastname>
  <Phone>String</Phone>
  <ResourceId>0</ResourceId>
  <Roles>
    <AddCompanyUserRolesResponse>
      <RoleId>00000000-0000-0000-0000-000000000000</RoleId>
    </AddCompanyUserRolesResponse>
  </Roles>
  <WorkerId>0</WorkerId>
</CreateCompanyUser>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CompanyUserQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Created>0001-01-01T00:00:00</Created>
  <Email>String</Email>
  <Firstname>String</Firstname>
  <Id>00000000-0000-0000-0000-000000000000</Id>
  <Lastname>String</Lastname>
  <Phone>String</Phone>
  <Resource>
    <Active>false</Active>
    <Color>String</Color>
    <Description>String</Description>
    <Email>String</Email>
    <EmailNotification>false</EmailNotification>
    <EmailReminder>false</EmailReminder>
    <Id>0</Id>
    <ImageUrl i:nil="true" />
    <Name>String</Name>
    <Phone>String</Phone>
    <SMSNotification>false</SMSNotification>
    <SMSReminder>false</SMSReminder>
  </Resource>
  <ResourceId>0</ResourceId>
  <Roles>
    <CompanyUserRolesQueryResponse>
      <Description>String</Description>
      <Name>String</Name>
      <RoleId>00000000-0000-0000-0000-000000000000</RoleId>
    </CompanyUserRolesQueryResponse>
  </Roles>
  <Updated>0001-01-01T00:00:00</Updated>
  <WorkerId>String</WorkerId>
</CompanyUserQueryResponse>