Platform API

<back to all web services

GetContactGroups

Get customers for current licensee

Requires Authentication
The following routes are available for this service:
All Verbs/api/contactgroups
All Verbs/api/contactgroups/{ContactId}
import Foundation
import ServiceStack

/**
* Get customers for current licensee
*/
// @Api(Description="Get customers for current licensee")
public class GetContactGroups : PagedModel
{
    /**
    * Get contactGroups for the specified contact
    */
    // @ApiMember(Description="Get contactGroups for the specified contact", Name="ContactId")
    public var contactId:String

    /**
    * Specific search text to search for i.e. Contact Name, Employment Details etc.
    */
    // @ApiMember(DataType="string", Description="Specific search text to search for i.e. Contact Name, Employment Details etc.", Name="SearchText")
    public var searchText:String

    /**
    * Set the Contact Group Role Id to only retrieve groups of that type. If ContactId is not set this is mandatory.
    */
    // @ApiMember(Description="Set the Contact Group Role Id to only retrieve groups of that type. If ContactId is not set this is mandatory.", Name="ContactGroupRoleId")
    public var contactGroupRoleId:String

    /**
    * Include active contact groups
    */
    // @ApiMember(Description="Include active contact groups", Name="IncludeActive")
    public var includeActive:Bool

    /**
    * Include archived contact groups
    */
    // @ApiMember(Description="Include archived contact groups", Name="IncludeArchived")
    public var includeArchived:Bool

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case contactId
        case searchText
        case contactGroupRoleId
        case includeActive
        case includeArchived
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        contactId = try container.decodeIfPresent(String.self, forKey: .contactId)
        searchText = try container.decodeIfPresent(String.self, forKey: .searchText)
        contactGroupRoleId = try container.decodeIfPresent(String.self, forKey: .contactGroupRoleId)
        includeActive = try container.decodeIfPresent(Bool.self, forKey: .includeActive)
        includeArchived = try container.decodeIfPresent(Bool.self, forKey: .includeArchived)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if contactId != nil { try container.encode(contactId, forKey: .contactId) }
        if searchText != nil { try container.encode(searchText, forKey: .searchText) }
        if contactGroupRoleId != nil { try container.encode(contactGroupRoleId, forKey: .contactGroupRoleId) }
        if includeActive != nil { try container.encode(includeActive, forKey: .includeActive) }
        if includeArchived != nil { try container.encode(includeArchived, forKey: .includeArchived) }
    }
}

public class PagedModel : Codable
{
    /**
    * Page Number to retrieve
    */
    // @ApiMember(DataType="int", Description="Page Number to retrieve", Name="PageNumber")
    public var pageNumber:Int

    /**
    * Number of records to retrieve
    */
    // @ApiMember(DataType="int", Description="Number of records to retrieve", Name="PageSize")
    public var pageSize:Int

    /**
    * Index of field to sort results by
    */
    // @ApiMember(DataType="int", Description="Index of field to sort results by", Name="SortIndex")
    public var sortIndex:Int

    /**
    * Sort Order - Ascending or Descending
    */
    // @ApiMember(DataType="int", Description="Sort Order - Ascending or Descending", Name="SortOrder")
    public var sortOrder:SortOrder

    required public init(){}
}

public enum SortOrder : String, Codable
{
    case Ascending
    case Descending
}

// @ApiResponse(Description="Get contact groups for current licensee")
public class GetContactGroupsResponse : Codable
{
    public var contactGroups:[ContactGroupModel]
    /**
    * Count of total groups.
    */
    // @ApiMember(DataType="int", Description="Count of total groups.", Name="TotalGroups")
    public var totalGroups:Int

    public var responseStatus:ResponseStatus

    required public init(){}
}

public class ContactGroupModel : Codable
{
    /**
    * Contact Group Id
    */
    // @ApiMember(DataType="Guid", Description="Contact Group Id", Name="ContactGroupId")
    public var contactGroupId:String

    /**
    * Contact Group Name
    */
    // @ApiMember(DataType="string", Description="Contact Group Name", Name="Name")
    public var name:String

    /**
    * Contact Group Reference
    */
    // @ApiMember(DataType="string", Description="Contact Group Reference", Name="Reference")
    public var reference:String

    /**
    * Group Role Id for e.g. Customer
    */
    // @ApiMember(DataType="Guid", Description="Group Role Id for e.g. Customer", Name="GroupRoleId")
    public var groupRoleId:String

    /**
    * Primary contact in the group
    */
    // @ApiMember(DataType="string", Description="Primary contact in the group", Name="PrimaryContactName")
    public var primaryContactName:String

    /**
    * Contact Id of the primary contact in the group
    */
    // @ApiMember(DataType="Guid", Description="Contact Id of the primary contact in the group", Name="PrimaryContactId")
    public var primaryContactId:String

    /**
    * Profile photo url of the primary contact in the group
    */
    // @ApiMember(DataType="string", Description="Profile photo url of the primary contact in the group", Name="PrimaryContactPhotoUrl")
    public var primaryContactPhotoUrl:String

    /**
    * Profile photo thumbnail url of the primary contact in the group
    */
    // @ApiMember(DataType="string", Description="Profile photo thumbnail url of the primary contact in the group", Name="PrimaryContactThumbnailUrl")
    public var primaryContactThumbnailUrl:String

    /**
    * Number of contacts in the group
    */
    // @ApiMember(DataType="int", Description="Number of contacts in the group", Name="NumberOfContacts")
    public var numberOfContacts:Int

    /**
    * Record Status of contact group
    */
    // @ApiMember(DataType="string", Description="Record Status of contact group", Name="RecordStatus")
    public var recordStatus:String

    /**
    * Details of contact in the contact group
    */
    // @ApiMember(DataType="List", Description="Details of contact in the contact group", Name="Contacts")
    public var contacts:[ContactGroupConnectionModel]

    /**
    * Details of projects for the contact group
    */
    // @ApiMember(DataType="List", Description="Details of projects for the contact group", Name="Projects")
    public var projects:[CustomerProjectModel]

    required public init(){}
}

public class ContactGroupConnectionModel : UserProfileSummaryModel
{
    /**
    * Contact Group Id
    */
    // @ApiMember(DataType="Guid", Description="Contact Group Id", Name="ContactGroupId")
    public var contactGroupId:String

    /**
    * Connection id of the contact in the group
    */
    // @ApiMember(DataType="string", Description="Connection id of the contact in the group", Name="ContactGroupConnectionId")
    public var contactGroupConnectionId:String

    /**
    * The Id of the Role this contact is connected to the group with.
    */
    // @ApiMember(DataType="string", Description="The Id of the Role this contact is connected to the group with.", Name="ConnectionRoleId")
    public var connectionRoleId:String

    /**
    * Order of contacts within a group, the primary contact will have an index of 1.
    */
    // @ApiMember(DataType="int", Description="Order of contacts within a group, the primary contact will have an index of 1.", Name="Index")
    public var index:Int

    /**
    * List of roles that the contact in the contact group has across appliances for e.g. Platform Customer, Nexus customer etc.
    */
    // @ApiMember(DataType="string", Description="List of roles that the contact in the contact group has across appliances for e.g. Platform Customer, Nexus customer etc.", Name="ContactRoles")
    public var contactRoles:[RoleModel]

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case contactGroupId
        case contactGroupConnectionId
        case connectionRoleId
        case index
        case contactRoles
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        contactGroupId = try container.decodeIfPresent(String.self, forKey: .contactGroupId)
        contactGroupConnectionId = try container.decodeIfPresent(String.self, forKey: .contactGroupConnectionId)
        connectionRoleId = try container.decodeIfPresent(String.self, forKey: .connectionRoleId)
        index = try container.decodeIfPresent(Int.self, forKey: .index)
        contactRoles = try container.decodeIfPresent([RoleModel].self, forKey: .contactRoles) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if contactGroupId != nil { try container.encode(contactGroupId, forKey: .contactGroupId) }
        if contactGroupConnectionId != nil { try container.encode(contactGroupConnectionId, forKey: .contactGroupConnectionId) }
        if connectionRoleId != nil { try container.encode(connectionRoleId, forKey: .connectionRoleId) }
        if index != nil { try container.encode(index, forKey: .index) }
        if contactRoles != nil { try container.encode(contactRoles, forKey: .contactRoles) }
    }
}

public class UserProfileSummaryModel : Codable
{
    /**
    * User Profile Id
    */
    // @ApiMember(DataType="Guid", Description="User Profile Id", Name="UserProfileId")
    public var userProfileId:String

    /**
    * User linked to the profile
    */
    // @ApiMember(DataType="Guid", Description="User linked to the profile", Name="UserId")
    public var userId:String

    /**
    * Contact linked to the profile
    */
    // @ApiMember(DataType="Guid", Description="Contact linked to the profile", Name="ContactId")
    public var contactId:String

    /**
    * User linked to the profile
    */
    // @ApiMember(DataType="string", Description="User linked to the profile", Name="UserName")
    public var userName:String

    /**
    * User Profile Name
    */
    // @ApiMember(DataType="string", Description="User Profile Name", Name="ProfileName")
    public var profileName:String

    /**
    * Full name of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Full name of the contact linked to the profile", Name="ContactFullName")
    public var contactFullName:String

    /**
    * Email Address of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Email Address of the contact linked to the profile", Name="EmailAddress")
    public var emailAddress:String

    /**
    * Email signature of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Email signature of the contact linked to the profile", Name="EmailSignature")
    public var emailSignature:String

    /**
    * Mobile number of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Mobile number of the contact linked to the profile", Name="MobileNumber")
    public var mobileNumber:String

    /**
    * Phone number of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Phone number of the contact linked to the profile", Name="PhoneNumber")
    public var phoneNumber:String

    /**
    * Type of contact (person, organisation etc.) linked to the profile
    */
    // @ApiMember(DataType="string", Description="Type of contact (person, organisation etc.) linked to the profile", Name="ContactTypeId")
    public var contactTypeId:String

    /**
    * Type of contact (person, organisation etc.) linked to the profile
    */
    // @ApiMember(DataType="string", Description="Type of contact (person, organisation etc.) linked to the profile", Name="ContactTypeName")
    public var contactTypeName:String

    /**
    * First name of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="First name of the contact linked to the profile", Name="FirstName")
    public var firstName:String

    /**
    * Surname of the contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Surname of the contact linked to the profile", Name="Surname")
    public var surname:String

    /**
    * Title of contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Title of contact linked to the profile", Name="Title")
    public var title:String

    /**
    * Legal name of contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Legal name of contact linked to the profile", Name="LegalName")
    public var legalName:String

    /**
    * Trading name of contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Trading name of contact linked to the profile", Name="TradingName")
    public var tradingName:String

    /**
    * Australian Business Number
    */
    // @ApiMember(DataType="string", Description="Australian Business Number", Name="Abn", ParameterType="query")
    public var abn:String

    /**
    * Australian Company Number
    */
    // @ApiMember(DataType="string", Description="Australian Company Number", Name="Acn", ParameterType="query")
    public var acn:String

    /**
    * Australian Registered Body Number
    */
    // @ApiMember(DataType="string", Description="Australian Registered Body Number", Name="Arbn", ParameterType="query")
    public var arbn:String

    /**
    * Indicates if the Contact is registered for GST.
    */
    // @ApiMember(DataType="bool", Description="Indicates if the Contact is registered for GST.", Name="GstRegistered", ParameterType="query")
    public var gstRegistered:Bool

    /**
    * True if english is a secondary language for the contact.
    */
    // @ApiMember(DataType="bool", Description="True if english is a secondary language for the contact.", Name="ESL", ParameterType="query")
    public var esl:Bool

    /**
    * Language that is the primary language for the contact.
    */
    // @ApiMember(DataType="string", Description="Language that is the primary language for the contact.", Name="Language", ParameterType="query")
    public var language:String

    /**
    * True if an interpreter is required.
    */
    // @ApiMember(DataType="bool", Description="True if an interpreter is required.", Name="InterpreterRequired", ParameterType="query")
    public var interpreterRequired:Bool

    /**
    * Licensee specific notes about the contact.
    */
    // @ApiMember(DataType="string", Description="Licensee specific notes about the contact.", Name="LicenseeNotes", ParameterType="query")
    public var licenseeNotes:String

    /**
    * Profile photo of contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Profile photo of contact linked to the profile", Name="ProfilePhotoUrl")
    public var profilePhotoUrl:String

    /**
    * Thumbnail photo of contact linked to the profile
    */
    // @ApiMember(DataType="string", Description="Thumbnail photo of contact linked to the profile", Name="ProfilePhotoThumbnailUrl")
    public var profilePhotoThumbnailUrl:String

    /**
    * Profile photo id of contact linked to the profile
    */
    // @ApiMember(DataType="Guid", Description="Profile photo id of contact linked to the profile", Name="ProfileImageId")
    public var profileImageId:String

    /**
    * Profile description
    */
    // @ApiMember(DataType="string", Description="Profile description", Name="Description")
    public var Description:String

    /**
    * Employment Industry
    */
    // @ApiMember(DataType="string", Description="Employment Industry", Name="EmploymentIndustry")
    public var employmentIndustry:String

    /**
    * Employment Role
    */
    // @ApiMember(DataType="string", Description="Employment Role", Name="EmploymentRole")
    public var employmentRole:String

    /**
    * Areas of Work
    */
    // @ApiMember(DataType="string", Description="Areas of Work", Name="EmploymentGeographicArea")
    public var employmentGeographicArea:String

    /**
    * The contacts timezone.
    */
    // @ApiMember(DataType="Guid", Description="The contacts timezone.", Name="Timezone", ParameterType="query")
    public var timezone:String

    /**
    * Timezone Name
    */
    // @ApiMember(DataType="string", Description="Timezone Name", Name="TimezoneName", ParameterType="query")
    public var timezoneName:String

    /**
    * The primary address of the contact
    */
    // @ApiMember(DataType="string", Description="The primary address of the contact", Name="PrimaryAddress", ParameterType="query")
    public var primaryAddress:String

    /**
    * Is this an active contact? Or an inactive contact (deleted account)?
    */
    // @ApiMember(DataType="bool", Description="Is this an active contact? Or an inactive contact (deleted account)?", Name="IsActiveContact")
    public var isActiveContact:Bool

    required public init(){}
}

public class RoleModel : Codable
{
    /**
    * Role Id
    */
    // @ApiMember(DataType="Guid", Description="Role Id", IsRequired=true, Name="RoleId")
    public var roleId:String

    /**
    * Role Name
    */
    // @ApiMember(DataType="string", Description="Role Name", Name="RoleName")
    public var roleName:String

    /**
    * Is the role a licensee role?
    */
    // @ApiMember(DataType="bool", Description="Is the role a licensee role?", Name="IsLicensee")
    public var isLicenseeRole:Bool

    /**
    * Is manage contacts role?
    */
    // @ApiMember(DataType="bool", Description="Is manage contacts role?", Name="IsManageContacts")
    public var isManageContacts:Bool

    /**
    * Is the role a Platform role?
    */
    // @ApiMember(DataType="bool", Description="Is the role a Platform role?", Name="IsPlatformRole")
    public var isPlatformRole:Bool

    /**
    * Is the role a services role?
    */
    // @ApiMember(DataType="bool", Description="Is the role a services role?", Name="IsServiceRole")
    public var isServiceRole:Bool

    /**
    * Is the role a customer role?
    */
    // @ApiMember(DataType="bool", Description="Is the role a customer role?", Name="IsCustomerRole")
    public var isCustomerRole:Bool

    /**
    * Is the role a functional role?
    */
    // @ApiMember(DataType="bool", Description="Is the role a functional role?", Name="IsFunctionalRole")
    public var isFunctionalRole:Bool

    /**
    * Is the role an auto-accept role?
    */
    // @ApiMember(DataType="bool", Description="Is the role an auto-accept role?", Name="IsRequestAutoAccepted")
    public var isRequestAutoAccepted:Bool

    /**
    * Suite that the role belongs to
    */
    // @ApiMember(DataType="Guid", Description="Suite that the role belongs to", Name="SuiteId")
    public var suiteId:String

    /**
    * Suite that the role belongs to
    */
    // @ApiMember(DataType="string", Description="Suite that the role belongs to", Name="SuiteName")
    public var suiteName:String

    /**
    * 'A' (Active) or 'I' (Inactive)
    */
    // @ApiMember(DataType="string", Description="'A' (Active) or 'I' (Inactive)", Name="RecordStatus")
    public var recordStatus:String

    /**
    * Object Connection Id, which is populated when the roles are returned based on those that are connected to an object.
    */
    // @ApiMember(DataType="Guid", Description="Object Connection Id, which is populated when the roles are returned based on those that are connected to an object.", Name="ObjectConnectionId")
    public var objectConnectionId:String

    required public init(){}
}

public class CustomerProjectModel : Codable
{
    public var projectId:String
    public var name:String
    public var projectAddress:String
    public var managerContactId:String?
    public var managerContactName:String
    public var managerProfilePhotoUrl:String
    public var managerProfilePhotoThumbnailUrl:String
    public var supervisorContactId:String?
    public var supervisorContactName:String
    public var supervisorProfilePhotoUrl:String
    public var supervisorProfilePhotoThumbnailUrl:String
    public var customerServiceContactId:String?
    public var customerServiceContactName:String
    public var customerServiceProfilePhotoUrl:String
    public var customerServiceProfilePhotoThumbnail:String

    required public init(){}
}


Swift GetContactGroups DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /api/contactgroups HTTP/1.1 
Host: pfapi.pstpf.com.au 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"ContactId":"00000000-0000-0000-0000-000000000000","SearchText":"String","ContactGroupRoleId":"00000000-0000-0000-0000-000000000000","IncludeActive":false,"IncludeArchived":false,"PageNumber":0,"PageSize":0,"SortIndex":0,"SortOrder":"Ascending"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ContactGroups":[{"ContactGroupId":"00000000-0000-0000-0000-000000000000","Name":"String","Reference":"String","GroupRoleId":"00000000-0000-0000-0000-000000000000","PrimaryContactName":"String","PrimaryContactId":"00000000-0000-0000-0000-000000000000","PrimaryContactPhotoUrl":"String","PrimaryContactThumbnailUrl":"String","NumberOfContacts":0,"RecordStatus":"String","Contacts":[{"ContactGroupId":"00000000-0000-0000-0000-000000000000","ContactGroupConnectionId":"00000000-0000-0000-0000-000000000000","ConnectionRoleId":"00000000-0000-0000-0000-000000000000","Index":0,"ContactRoles":[{"RoleId":"00000000-0000-0000-0000-000000000000","RoleName":"String","IsLicenseeRole":false,"IsManageContacts":false,"IsPlatformRole":false,"IsServiceRole":false,"IsCustomerRole":false,"IsFunctionalRole":false,"IsRequestAutoAccepted":false,"SuiteId":"00000000-0000-0000-0000-000000000000","SuiteName":"String","RecordStatus":"String","ObjectConnectionId":"00000000-0000-0000-0000-000000000000"}],"UserProfileId":"00000000-0000-0000-0000-000000000000","UserId":"00000000-0000-0000-0000-000000000000","ContactId":"00000000-0000-0000-0000-000000000000","UserName":"String","ProfileName":"String","ContactFullName":"String","EmailAddress":"String","EmailSignature":"String","MobileNumber":"String","PhoneNumber":"String","ContactTypeId":"00000000-0000-0000-0000-000000000000","ContactTypeName":"String","FirstName":"String","Surname":"String","Title":"String","LegalName":"String","TradingName":"String","Abn":"String","Acn":"String","Arbn":"String","GstRegistered":false,"ESL":false,"Language":"String","InterpreterRequired":false,"LicenseeNotes":"String","ProfilePhotoUrl":"String","ProfilePhotoThumbnailUrl":"String","ProfileImageId":"00000000-0000-0000-0000-000000000000","Description":"String","EmploymentIndustry":"String","EmploymentRole":"String","EmploymentGeographicArea":"String","Timezone":"00000000-0000-0000-0000-000000000000","TimezoneName":"String","PrimaryAddress":"String","IsActiveContact":false}],"Projects":[{"ProjectId":"00000000-0000-0000-0000-000000000000","Name":"String","ProjectAddress":"String","ManagerContactId":"00000000000000000000000000000000","ManagerContactName":"String","ManagerProfilePhotoUrl":"String","ManagerProfilePhotoThumbnailUrl":"String","SupervisorContactId":"00000000000000000000000000000000","SupervisorContactName":"String","SupervisorProfilePhotoUrl":"String","SupervisorProfilePhotoThumbnailUrl":"String","CustomerServiceContactId":"00000000000000000000000000000000","CustomerServiceContactName":"String","CustomerServiceProfilePhotoUrl":"String","CustomerServiceProfilePhotoThumbnail":"String"}]}],"TotalGroups":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}