Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /administrators/ | Add a new administrator to your company | If you want to add a new administrator to your company. A generated password will be sent to the user. |
---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
public class dtos
{
@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 static class CreateCompanyUser implements ICompany
{
/**
* 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 UUID CompanyId = null;
@ApiMember(IsRequired=true)
public String Firstname = null;
@ApiMember(IsRequired=true)
public String Lastname = null;
@ApiMember(IsRequired=true)
public String Phone = null;
@ApiMember(IsRequired=true)
public String Email = null;
@ApiMember()
public Integer ResourceId = null;
@ApiMember()
public ArrayList<AddCompanyUserRolesResponse> Roles = null;
@ApiMember()
public Integer WorkerId = null;
public UUID getCompanyId() { return CompanyId; }
public CreateCompanyUser setCompanyId(UUID value) { this.CompanyId = value; return this; }
public String getFirstname() { return Firstname; }
public CreateCompanyUser setFirstname(String value) { this.Firstname = value; return this; }
public String getLastname() { return Lastname; }
public CreateCompanyUser setLastname(String value) { this.Lastname = value; return this; }
public String getPhone() { return Phone; }
public CreateCompanyUser setPhone(String value) { this.Phone = value; return this; }
public String getEmail() { return Email; }
public CreateCompanyUser setEmail(String value) { this.Email = value; return this; }
public Integer getResourceId() { return ResourceId; }
public CreateCompanyUser setResourceId(Integer value) { this.ResourceId = value; return this; }
public ArrayList<AddCompanyUserRolesResponse> getRoles() { return Roles; }
public CreateCompanyUser setRoles(ArrayList<AddCompanyUserRolesResponse> value) { this.Roles = value; return this; }
public Integer getWorkerId() { return WorkerId; }
public CreateCompanyUser setWorkerId(Integer value) { this.WorkerId = value; return this; }
}
public static class AddCompanyUserRolesResponse
{
public UUID RoleId = null;
public UUID getRoleId() { return RoleId; }
public AddCompanyUserRolesResponse setRoleId(UUID value) { this.RoleId = value; return this; }
}
public static class CompanyUserQueryResponse
{
public UUID Id = null;
public UUID CompanyId = null;
public String Firstname = null;
public String Lastname = null;
public String Email = null;
public String Phone = null;
public String WorkerId = null;
public Integer ResourceId = null;
/**
* The resource information connected to the administrator.
*/
@ApiMember(Description="The resource information connected to the administrator.")
public CompanyUserResource Resource = null;
/**
* The roles that are connected to the administrator.
*/
@ApiMember(Description="The roles that are connected to the administrator.")
public ArrayList<CompanyUserRolesQueryResponse> Roles = null;
public Boolean Active = null;
public Date Created = null;
public Date Updated = null;
public UUID getId() { return Id; }
public CompanyUserQueryResponse setId(UUID value) { this.Id = value; return this; }
public UUID getCompanyId() { return CompanyId; }
public CompanyUserQueryResponse setCompanyId(UUID value) { this.CompanyId = value; return this; }
public String getFirstname() { return Firstname; }
public CompanyUserQueryResponse setFirstname(String value) { this.Firstname = value; return this; }
public String getLastname() { return Lastname; }
public CompanyUserQueryResponse setLastname(String value) { this.Lastname = value; return this; }
public String getEmail() { return Email; }
public CompanyUserQueryResponse setEmail(String value) { this.Email = value; return this; }
public String getPhone() { return Phone; }
public CompanyUserQueryResponse setPhone(String value) { this.Phone = value; return this; }
public String getWorkerId() { return WorkerId; }
public CompanyUserQueryResponse setWorkerId(String value) { this.WorkerId = value; return this; }
public Integer getResourceId() { return ResourceId; }
public CompanyUserQueryResponse setResourceId(Integer value) { this.ResourceId = value; return this; }
public CompanyUserResource getResource() { return Resource; }
public CompanyUserQueryResponse setResource(CompanyUserResource value) { this.Resource = value; return this; }
public ArrayList<CompanyUserRolesQueryResponse> getRoles() { return Roles; }
public CompanyUserQueryResponse setRoles(ArrayList<CompanyUserRolesQueryResponse> value) { this.Roles = value; return this; }
public Boolean isActive() { return Active; }
public CompanyUserQueryResponse setActive(Boolean value) { this.Active = value; return this; }
public Date getCreated() { return Created; }
public CompanyUserQueryResponse setCreated(Date value) { this.Created = value; return this; }
public Date getUpdated() { return Updated; }
public CompanyUserQueryResponse setUpdated(Date value) { this.Updated = value; return this; }
}
public static class CompanyUserResource
{
/**
* The resource id
*/
@ApiMember(Description="The resource id")
public Integer Id = null;
/**
* The resource name
*/
@ApiMember(Description="The resource name")
public String Name = null;
/**
* The resource status
*/
@ApiMember(Description="The resource status")
public Boolean Active = null;
/**
* The resource description
*/
@ApiMember(Description="The resource description")
public String Description = null;
/**
* The resource email
*/
@ApiMember(Description="The resource email")
public String Email = null;
/**
* The resource phone
*/
@ApiMember(Description="The resource phone")
public String Phone = null;
/**
* The resource color
*/
@ApiMember(Description="The resource color")
public String Color = null;
/**
* The resource image
*/
@ApiMember(Description="The resource image")
public Uri ImageUrl = null;
/**
* If the resource want to receive email notifications
*/
@ApiMember(Description="If the resource want to receive email notifications")
public Boolean EmailNotification = null;
/**
* If the resource want to receive sms notifications
*/
@ApiMember(Description="If the resource want to receive sms notifications")
public Boolean SMSNotification = null;
/**
* If the resource want to receive email reminders
*/
@ApiMember(Description="If the resource want to receive email reminders")
public Boolean EmailReminder = null;
/**
* If the resource want to receive sms reminders
*/
@ApiMember(Description="If the resource want to receive sms reminders")
public Boolean SMSReminder = null;
public Integer getId() { return Id; }
public CompanyUserResource setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public CompanyUserResource setName(String value) { this.Name = value; return this; }
public Boolean isActive() { return Active; }
public CompanyUserResource setActive(Boolean value) { this.Active = value; return this; }
public String getDescription() { return Description; }
public CompanyUserResource setDescription(String value) { this.Description = value; return this; }
public String getEmail() { return Email; }
public CompanyUserResource setEmail(String value) { this.Email = value; return this; }
public String getPhone() { return Phone; }
public CompanyUserResource setPhone(String value) { this.Phone = value; return this; }
public String getColor() { return Color; }
public CompanyUserResource setColor(String value) { this.Color = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public CompanyUserResource setImageUrl(Uri value) { this.ImageUrl = value; return this; }
public Boolean isEmailNotification() { return EmailNotification; }
public CompanyUserResource setEmailNotification(Boolean value) { this.EmailNotification = value; return this; }
public Boolean isSmsNotification() { return SMSNotification; }
public CompanyUserResource setSmsNotification(Boolean value) { this.SMSNotification = value; return this; }
public Boolean isEmailReminder() { return EmailReminder; }
public CompanyUserResource setEmailReminder(Boolean value) { this.EmailReminder = value; return this; }
public Boolean isSmsReminder() { return SMSReminder; }
public CompanyUserResource setSmsReminder(Boolean value) { this.SMSReminder = value; return this; }
}
public static class CompanyUserRolesQueryResponse
{
public UUID RoleId = null;
public String Name = null;
public String Description = null;
public UUID getRoleId() { return RoleId; }
public CompanyUserRolesQueryResponse setRoleId(UUID value) { this.RoleId = value; return this; }
public String getName() { return Name; }
public CompanyUserRolesQueryResponse setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public CompanyUserRolesQueryResponse setDescription(String value) { this.Description = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=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: testapi.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 }