HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Guides

Individual

Person, Party

Create an individual

Example of creating a new individual and setting their communication preference and address.

using Asi.Soa.ClientServices;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// Create a new person
var personData = new PersonData
{
  PersonName = new PersonNameData {FirstName = "George", LastName = "Smith"},
  Addresses = new FullAddressDataCollection
  {
    new FullAddressData
    {
      AddressPurpose = "Address",
      CommunicationPreferences = new CommunicationPreferenceDataCollection
      {
        new CommunicationPreferenceData
        {
          Reason = "mail"
        }
      },
      Address = new AddressData
      {
        AddressLines = new AddressLineDataCollection {"14211 South First"},
        CityName = "Austin",
        CountrySubEntityCode = "TX",
        CountyCode = "US",
        PostalCode = "78759"
      }
    }
  }
};

// Save
var results = entityManager.Add(personData);
if (results.IsValid)
{
  personData = results.Entity;
  Console.WriteLine("Person - Id: {0}, Name: {1}", personData.PartyId, personData.Name);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}
using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace RestDemo
{
    public class Program
    {
        public void CreateAnIndividualRestfulExample()
        {
            // Instantiate new Party object to be used in REST call to the Party service 
            var partyModel = new PartyModel
            {
                Type = "Asi.Soa.Membership.DataContracts.PersonData, Asi.Soa.Membership.Contracts",
                PersonName = new PersonName
                {
                    Type = "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Soa.Membership.Contracts",
                    FirstName = "George",
                    InformalName = "William",
                    LastName = "Milburn",
                    NamePrefix = "Mr."
                }
            };

            // Serialize above object to JSON, create HTTP content to be used in POST call
            var jsonObject = JsonConvert.SerializeObject(partyModel, Formatting.None,
                new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore});
            var httpContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");
          
            HttpClient client = new HttpClient();

            /*
            Add proper authorization header to new HttpClient above 
            before making below request, see 
            https://developer.imis.com/v0.1/docs/accessing-the-rest-api#section-direct-access-oauth-20 
            for an example of how to perform this in C# project
            */

            var party = client.PostAsync("api/party", httpContent).Result;

            if (party != null && party.IsSuccessStatusCode)
            {
                Console.WriteLine("Party: {0}", party.Content.ReadAsStringAsync().Result);
            }
        }
    }

    internal class PartyModel
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string PartyId { get; set; }

        public PersonName PersonName { get; set; }

        public PrimaryOrganization PrimaryOrganization { get; set; }
    }
  
    internal class PrimaryOrganization
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string OrganizationPartyId { get; set; }

        public string Name { get; set; }

        public string Title { get; set; }
    }

    internal class PersonName
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string FirstName { get; set; }

        public string InformalName { get; set; }

        public string LastName { get; set; }

        public string NamePrefix { get; set; }
    }
}

/*
Party: {  
   "$type":"Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
   "PersonName":{  
      "$type":"Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
      "FirstName":"George",
      "InformalName":"William",
      "LastName":"Milburn",
      "NamePrefix":"Mr.",
      "FullName":"Mr. George Milburn"
   },
   "AdditionalAttributes":{  
      "$type":"Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeDescription",
            "Value":"Non Member"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMemberRecord",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeCode",
            "Value":"NM"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsInactiveMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"AllowAdvanceRenewal",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"JoinDate",
            "Value":"0001-01-01T00:00:00"
         }
      ]
   },
   "Addresses":{  
      "$type":"Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"13663",
               "VerificationStatus":0
            },
            "AddresseeText":"Mr. George Milburn\r\n",
            "AddressPurpose":"Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"default"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"mail"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"bill"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"ship"
                  }
               ]
            },
            "FullAddressId":"13663",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Mr. George Milburn"
            },
            "DisplayName":"William"
         }
      ]
   },
   "AlternateIds":{  
      "$type":"Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
            "Id":"23188",
            "IdType":"Id"
         }
      ]
   },
   "FinancialInformation":{  
      "$type":"Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
   },
   "Salutations":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "SocialNetworks":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySocialNetworkDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "CommunicationTypePreferences":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartyCommunicationTypePreferenceDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "SortIsOverridden":false,
   "UpdateInformation":{  
      "$type":"Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
      "CreatedBy":"BRIANM",
      "CreatedOn":"2017-12-18T13:41:12.873",
      "UpdatedBy":"BRIANM",
      "UpdatedOn":"2017-12-18T13:41:12.873"
   },
   "PartyId":"23188",
   "Id":"23188",
   "UniformId":"f8bd1fd7-7524-4fd5-8654-4346159a173b",
   "Status":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
      "PartyStatusId":"A",
      "Name":"Active",
      "Description":"Active"
   },
   "Name":"Mr. George Milburn",
   "Sort":"Milburn, George"
}
*/

Modify an individual's address

using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// New values to update a party
var newMailAddress1 = "14233 Third Street";
var newEmailAddress = "[email protected]";

// Create a new person
var personData = new PersonData
{
  PersonName = new PersonNameData {FirstName = "Steve", LastName = "Smith"},
  Addresses = new FullAddressDataCollection
  {
    new FullAddressData
    {
      AddressPurpose = "Address",
      CommunicationPreferences = new CommunicationPreferenceDataCollection
      {
        new CommunicationPreferenceData
        {
          Reason = "mail"
        }
      },
      Address = new AddressData
      {
        AddressLines = new AddressLineDataCollection {"14211 Second Street"},
        CityName = "Austin",
        CountrySubEntityCode = "TX",
        CountyCode = "US",
        PostalCode = "78758"
      }
    }
  }
};

personData.GetPreferredAddress("mail").Email = "[email protected]";

// Save 
var results = entityManager.Add(personData);
if (!results.IsValid)
{
  Console.WriteLine(results.ValidationResults.Summary);
  return;
}

// Get the new person
PartyData partyData = results.Entity;

// Find the preferred mailing address
FullAddressData mailAddress =
  partyData.Addresses.FirstOrDefault(address => address.CommunicationPreferences.Contains("mail"));

// All records should have a mailing address, even if it's blank - but just in case, we can create a new object if it's null
if (partyData.Addresses == null)
  partyData.Addresses = new FullAddressDataCollection();

if (mailAddress == null)
  mailAddress = new FullAddressData
{
  CommunicationPreferences =
    new CommunicationPreferenceDataCollection {new CommunicationPreferenceData {Reason = "mail"}}
};

if (mailAddress.Address == null)
  mailAddress.Address = new AddressData();

if (mailAddress.Address.AddressLines == null)
  mailAddress.Address.AddressLines = new AddressLineDataCollection();

// Assign the new mailing address
if (mailAddress.Address.AddressLines.Count < 1)
  mailAddress.Address.AddressLines.Add(newMailAddress1);
else
  mailAddress.Address.AddressLines[0] = newMailAddress1;

// Assign the new email address
mailAddress.Email = newEmailAddress;

// Update party
results = new ValidateResultsData<PersonData>(entityManager.Update(partyData));
if (results.IsValid)
{
  partyData = results.Entity;
  Console.WriteLine("Person - Id: {0}, Name: {1}", partyData.PartyId, partyData.Name);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}
using System;
using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// Create values to update a party
var newCustomIdTypeName = "CustomId";
var newCustomId = Guid.NewGuid().ToString().Substring(1, 5);
var newMajorKey = Guid.NewGuid().ToString().Substring(1, 15);
var newCustomerType = "M";
var newJoinDate = new DateTime(2016, 1, 1);
var newParentPartyId = "101"; // Existing parent company Id
var newBillingCateogry = "1"; // Code for "Billing category 1"

// Create a new person
var personData = new PersonData
{
  PersonName = new PersonNameData {FirstName = "Steve", LastName = "Smith"},
  Addresses = new FullAddressDataCollection
  {
    new FullAddressData
    {
      AddressPurpose = "Address",
      CommunicationPreferences = new CommunicationPreferenceDataCollection
      {
        new CommunicationPreferenceData
        {
          Reason = "mail"
        }
      },
      Address = new AddressData
      {
        AddressLines = new AddressLineDataCollection {"14211 Second Street"},
        CityName = "Austin",
        CountrySubEntityCode = "TX",
        CountyCode = "US",
        PostalCode = "78758"
      }
    }
  }
};

// Save 
var results = entityManager.Add(personData);
if (!results.IsValid)
{
  Console.WriteLine(results.ValidationResults.Summary);
  return;
}

PartyData partyData = results.Entity;

// Make changes to person
if (partyData.AdditionalAttributes == null)
  partyData.AdditionalAttributes = new GenericPropertyDataCollection();

// Alternate Ids can contain any custom ids you need - these are stored in Name_AlternateId
var customParty = partyData.AlternateIds.FirstOrDefault(altId =>
                                                        altId.IdType.Equals(newCustomIdTypeName, StringComparison.InvariantCultureIgnoreCase));

var originalCustomPartyId = customParty?.Id;
if (originalCustomPartyId != null)
{
  foreach (var ai in partyData.AlternateIds.Where(ai =>
                                                  ai.IdType.Equals(newCustomIdTypeName, StringComparison.OrdinalIgnoreCase)))
  {
    ai.Id = newCustomId;
    break;
  }
}
else
{
  partyData.AlternateIds.Add(new AlternateIdData(newCustomIdTypeName, newCustomId));
}

partyData.AdditionalAttributes.SetPropertyValue("MajorKey", newMajorKey);
partyData.AdditionalAttributes.SetPropertyValue("CustomerTypeCode", newCustomerType);
partyData.AdditionalAttributes.SetPropertyValue("JoinDate", newJoinDate);
partyData.AdditionalAttributes.SetPropertyValue("ParentPartyId", newParentPartyId);
partyData.AdditionalAttributes.SetPropertyValue("BillingCategory", newBillingCateogry);

// Update
results = new ValidateResultsData<PersonData>(entityManager.Update(partyData));
if (results.IsValid)
{
  partyData = results.Entity;
  Console.WriteLine("Person - Id: {0}, Name: {1}", partyData.PartyId, partyData.Name);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}
using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace RestDemo
{
    public class Program
    {
        public void ModifyAnIndividualNamePrefixRestfulExample()
        {
          // Instantiate new Party object to be used in REST call to the Party service 
          var partyModel = new PartyModel
          {
            Type = "Asi.Soa.Membership.DataContracts.PersonData, Asi.Soa.Membership.Contracts",
            PersonName = new PersonName
            {
              Type = "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Soa.Membership.Contracts",
              FirstName = "George",
              InformalName = "William",
              LastName = "Milburn",
              NamePrefix = "Mr."
            }
          };

          // Serialize above object to JSON, create HTTP content to be used in POST call
          var jsonObject = JsonConvert.SerializeObject(partyModel, Formatting.None,
                                                       new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore});
          var httpContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");

          HttpClient client = new HttpClient();

          /*
          Add proper authorization header to new HttpClient above 
          before making below request, see 
          https://developer.imis.com/v0.1/docs/accessing-the-rest-api#section-direct-access-oauth-20 
          for an example of how to perform this in C# project
          */

          var party = RestfulCodeExamplesTestHelper.Client.PostAsync("api/party", httpContent).Result;

          if (party != null && party.IsSuccessStatusCode)
          {
            Console.WriteLine("Party: {0}", party.Content.ReadAsStringAsync().Result);
          }
      }
    }

    internal class PartyModel
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string PartyId { get; set; }

        public PersonName PersonName { get; set; }

        public PrimaryOrganization PrimaryOrganization { get; set; }
    }

    internal class PersonName
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string FirstName { get; set; }

        public string InformalName { get; set; }

        public string LastName { get; set; }

        public string NamePrefix { get; set; }
    }
}

/*
Party: {  
   "$type":"Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
   "PersonName":{  
      "$type":"Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
      "FirstName":"George",
      "LastName":"Milburn",
      "NamePrefix":"Dr.",
      "FullName":"Mr. George Milburn"
   },
   "PrimaryOrganization":{  
      "$type":"Asi.Soa.Membership.DataContracts.PrimaryOrganizationInformationData, Asi.Contracts",
      "OrganizationPartyId":"19762",
      "Name":"Western Municipalities"
   },
   "AdditionalAttributes":{  
      "$type":"Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeDescription",
            "Value":"Staff"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMemberRecord",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeCode",
            "Value":"STF"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsInactiveMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"AllowAdvanceRenewal",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"JoinDate",
            "Value":"0001-01-01T00:00:00"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"ParentPartyId",
            "Value":"19762"
         }
      ]
   },
   "Addresses":{  
      "$type":"Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"8444",
               "AddressLines":{  
                  "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                  "$values":[  
                     "500 Lake Cliff Dr"
                  ]
               },
               "CityName":"Boulder",
               "CountryCode":"US",
               "CountryName":"United States",
               "CountrySubEntityCode":"CO",
               "CountrySubEntityName":"Colorado",
               "FullAddress":"500 Lake Cliff Dr\rBoulder, CO  80303\rUNITED STATES",
               "PostalCode":"80303",
               "VerificationStatus":0
            },
            "AddresseeText":"Mr. George Milburn\r\n500 Lake Cliff Dr\rBoulder, CO  80303\rUNITED STATES",
            "AddressPurpose":"Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"default"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"mail"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"bill"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"ship"
                  }
               ]
            },
            "Email":"[email protected]",
            "Fax":"(516) 987-0000",
            "FullAddressId":"8444",
            "Note":"P.S.I. Code 9450",
            "Phone":"(720) 535-4390",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Mr. George Milburn"
            },
            "DisplayName":"William",
            "DisplayOrganizationName":"Western Municipalities"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"13516",
               "AddressLines":{  
                  "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                  "$values":[  
                     "3554 Maple Street"
                  ]
               },
               "CityName":"Edina",
               "CountryCode":"US",
               "CountryName":"United States",
               "CountrySubEntityCode":"MN",
               "CountrySubEntityName":"Minnesota",
               "FullAddress":"3554 Maple Street\rEdina, MN  \rUNITED STATES",
               "VerificationStatus":0
            },
            "AddresseeText":"Mr. George Milburn\r\n3554 Maple Street\rEdina, MN  \rUNITED STATES",
            "AddressPurpose":"Home Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "FullAddressId":"13516",
            "Phone":"(917) 555-3434",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Mr. George Milburn"
            },
            "DisplayName":"William",
            "DisplayOrganizationName":"Western Municipalities"
         }
      ]
   },
   "AlternateIds":{  
      "$type":"Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
            "Id":"18052",
            "IdType":"Id"
         }
      ]
   },
   "Emails":{  
      "$type":"Asi.Soa.Membership.DataContracts.EmailDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
            "Address":"[email protected]",
            "EmailType":"_Primary",
            "IsPrimary":true
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
            "Address":"[email protected]",
            "EmailType":"Address"
         }
      ]
   },
   "FinancialInformation":{  
      "$type":"Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
   },
   "Phones":{  
      "$type":"Asi.Soa.Membership.DataContracts.PhoneDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(720) 535-4390",
            "PhoneType":"_Work Phone"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(791) 829-6838",
            "PhoneType":"Mobile"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(720) 535-4390",
            "PhoneType":"Address"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(516) 987-0000",
            "PhoneType":"Address Fax"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(917) 555-3434",
            "PhoneType":"Home Address"
         }
      ]
   },
   "Salutations":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
            "SalutationId":"18052",
            "SalutationMethod":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
               "PartySalutationMethodId":"LIST_AS"
            },
            "Text":"Elaine Beauchamp"
         }
      ]
   },
   "SortIsOverridden":false,
   "UpdateInformation":{  
      "$type":"Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
      "CreatedBy":"AMOORE",
      "CreatedOn":"2011-04-07T09:52:19.65",
      "UpdatedBy":"BRIANM",
      "UpdatedOn":"2017-12-18T13:41:18.193"
   },
   "PartyId":"18052",
   "UniformId":"e2124f8b-39fa-4690-be19-0cfab0a1def5",
   "Name":"Mr. George Milburn",
   "Sort":"Milburn, George"
}
*/

Get an individual's summary data

using System;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

string partyId = "18043"; // Chris Baker

var findResultsData =
  entityManager.Find(
  new QueryData(PartySummaryData.EntityTypeName)
  .AddCriteria(new CriteriaData("PartyId", OperationData.Equal, partyId))).Result;

if (findResultsData[0] is PartySummaryData partySummaryData)
{
  Console.WriteLine("Party Name: {0}", partySummaryData.Name); // Dr. Chris L. Baker, PhD
  Console.WriteLine("Party Email: {0}", partySummaryData.Email); // [email protected]
}
using System;
using System.Net.Http;

const string partyId = "18052"; // Brian Murphy

HttpClient client = new HttpClient();

/*
Add proper authorization header to new HttpClient above 
before making below request, see 
https://developer.imis.com/v0.1/docs/accessing-the-rest-api#section-direct-access-oauth-20 
for an example of how to perform this in C# project
*/

var partySummary = client.GetAsync($"api/partysummary/{partyId}").Result;

if (partySummary != null)
{
  Console.WriteLine("Party Summary: {0}", partySummary.Content.ReadAsStringAsync().Result);
}

/*
{
    "$type": "Asi.Soa.Membership.DataContracts.PartySummaryData, Asi.Contracts",
    "CityName": "Eden Prairie",
    "CountryName": "United States",
    "CountrySubEntityName": "MN",
    "Email": "[email protected]",
    "Phone": "(516) 987-2222",
    "PartyId": "18052",
    "Id": "18052",
    "UniformId": "e2124f8b-39fa-4690-be19-0cfab0a1def5",
    "Status": {
        "$type": "Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
        "PartyStatusId": "A",
        "Name": "Active",
        "Description": "Active"
    },
    "Name": "Mr. Brian Murphy",
    "Sort": "MURPHY, BRIAN",
    "IsMarkedForDelete": false
}
*/

Contact us
Copyright © Advanced Solutions International, All rights reserved.