API Documentation

In-depth reference documentation for iQmetrix API's.

NAV

OVERVIEW

The Customer Relationship Management (CRM) API gives you a full suite of options to create, modify, or delete customers, or to modify customer information such as addresses and contact methods.

BASE URLS

Demo: https://crmdemo.iqmetrix.net/v1
Production: https://crm.iqmetrix.net/v1

RESOURCES

Address

The Address resource records information for a single customer address. You can define multiple addresses for a customer.

{
    "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressType": "Home",
    "AddressTypeId": 2,
    "Country": "Canada",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "State": "Alberta",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500",
    "Version": 1,
    "AttentionTo": "Princess"
}
Name Description
Id (GUID) The address identifier.
CustomerId (GUID) The identifier of the Customer associated with this address.
AddressType (String) Read-only. A string representing the address type specified in AddressTypeId.
AddressTypeId (Integer) The code for the address type. For supported values, see AddressTypeId.
Country (String) Read-only. A string representing the country specified in CountryCode.
CountryCode (String) The ISO 3166-2 alpha-2 code for the country where this address is located. To see the list of these codes, see Getting All Countries.
Default (Boolean) A flag indicating whether this address is the default address for the customer.
DoNotContact (Boolean) A flag indicating whether this address is private and not to be used by any external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Email (String) The contact email for this address.
Locality (String) The locality (for example, city, town, or hamlet) of this address.
Notes (String) Any notes related to this address.
Phone (String) The contact phone number for this address.
PostalCode (String) The postal code/zip code for this address.
PostOfficeBoxNumber (String) The post office box number for this address.
State (String) Read-only. A string representing the state, province, or region specified in StateCode.
StateCode (String(2)) The ISO 3166-2 alpha-2 Region code for the state or province where this address resides. To see a list of these codes, see Getting All Countries.
StreetAddress1 (String) Line 1 of the street address.
StreetAddress2 (String) Line 2 of the street address.
Version (Integer) System-generated. The latest revision number of this resource. This field is used to prevent collisions in updating the resource.
AttentionTo (String) The name of the person or department residing at this address.

ContactMethod

A ContactMethod resource records the information for contacting a customer. You can define multiple contact methods for a customer.

{
    "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategory": "Phone",
    "ContactMethodCategoryId": 1,
    "ContactMethodType": "Work",
    "ContactMethodTypeId": 2,
    "Default": true,
    "DoNotContact": true,
    "Notes": "After 6pm",
    "Value": "(306) 222-3333",
    "Version": 1
}
Name Description
Id (GUID) The identifier of the contact method.
CustomerId (GUID) The identifier of the Customer associated with the contact method.
ContactMethodCategory (String) A string representing the contact method category specified in ContactMethodCategoryId. For a list of supported types and categories, see ContactMethod Types and Categories.
ContactMethodCategoryId (Integer) The numeric code for the contact method category. For a list of supported types and categories, see ContactMethod Types and Categories.
ContactMethodType (Integer) Read-only. A string representing the contact method type specified in ContactMethodTypeId. For a list of supported types and categories, see ContactMethod Types and Categories.
ContactMethodTypeId (Integer) The code representing the contact method type. For a list of supported types and categories, see ContactMethod Types and Categories.
Default (Boolean) A flag indicating whether this is the default contact method for the customer.
DoNotContact (Boolean) A flag indicating whether this address is private and not to be used by any external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Notes related to this ContactMethod
Value (String) The actual information for that contact method: for example, the actual email address or phone number. Email addresses are validated (but not verified).
Version (Integer) System-generated. The latest revision number of this resource. This field is used to prevent collisions in updating the resource.

Customer

A customer is a person or organization who buys goods or services from a store or business. The Customer resource contains basic customer information.

{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "Title": "Ms",
    "CustomerType": "Company",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "PricingGroupId": null,
    "Disabled": false,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Version": 1,
    "MergedIntoCustomerId": null,
    "LastModifiedDateUtc": "2018-05-29T32:16:03",
    "UniqueIdentifier": "5003000000D8cuI"
}
Name Description
Id (GUID) The customer identifier.
PrimaryName (String) For a person, the first or given name. For an organization, business, or division, the full name. Maximum 100 characters.
MiddleName (String) The customer’s middle name. Maximum 50 characters.
FamilyName (String) The customer’s surname or last name. Maximum 100 characters.
AlternateName (String) The alias or preferred name for the customer. Maximum 50 characters.
Title (String) The title to be used in customer salutations. Maximum 50 characters.
CustomerType (String) Read-only. A string representing the customer type specified in CustomerTypeId.
CustomerTypeId (Integer) The code for the customer type. For supported values, see CustomerTypeId.
DateOfBirth (DateTime) The customer’s birth date, in UTC. You can use a full timestamp or shortened form (yyyy-mm-dd).
PricingGroupId (Integer) The identifier of the pricing group the customer belongs to. This identifier hs validated on create and update.
Disabled (Boolean) A flag indicating whether or not this customer is disabled. Deleting a customer acts as a Disable operation, as a Customer cannot be fully deleted. The default is false. When the Disabled flag is set to true, the Customer can still be retrieved and updated normally. Filterable.
DoNotContact (Boolean) A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Any notes related to this customer. Maximum 2000 characters.
Version (Integer) System-generated. The latest revision number of this resource. This field is used to prevent collisions in updating the resource.
MergedIntoCustomerId (GUID) For records that have been merged into another record, the identifier of the customer record into which this record has been merged.
LastModifiedDateUtc (DateTime) Read-only. The date and time of the most recent update to the record, in UTC. The system initially sets this value to the date of creation and revises it with every update to any information associated with the customer (that is, an update to any property in the associated CustomerFull record). Querying for this property is supported on the CustomerFull resource but not the Customer endpoint (even though the property is part of the Customer resource).
UniqueIdentifier (String) Maximum 100 characters. This identifier may either be directly set or not. If directly set, the identifier provided must be unique across the associated company. If not set, the system automatically generates an identifier that is unique across the company. Unique identifiers are case-insensitive.

CustomerExtension

A CustomerExtension resource sets the value for an extension (CustomerExtensionType) for a given customer.

{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionType": "ExternalCustomerId",
    "ExtensionTypeId": 2,
    "ExtensionTypeFeature": "CRM",
    "Value": "66432",
    "Version": 1
}
Name Description
Id (GUID) The identifier of the extension.
CustomerId (GUID) Read-only. The identifier of the Customer associated with the extension.
ExtensionType (String) Read-only. The name of the property–for example PhysicianName.
ExtensionTypeId (Integer) The identifier of the extension type. For supported values, see ExtensionTypeId.
ExtensionTypeFeature (String) Read-only. The availability of this extension. Supported values are CRM (Available to all companies, including dispensaries) and Dispensary (Available only to companies configured as dispensaries).
Value (String) The value to set for the custom property.
Version (Integer) Read-only. The latest revision number of this resource. This field is used to prevent collisions in updating the resource.

CustomerExtensionType

A CustomerExtensionType resource is an extension to the standard customer record–for example, to capture a driver’s license number or physician name. The list of extensions is implemented and maintained by iQmetrix.

There are two classifications of extensions:

To see all the customer extension types that are currently implemented, see GET All Customer Extension Types. If you feel you need an extension to the standard customer record implemented, contact your iQmetrix representative.

[
    {
        "Id": 118,
        "Name": "DriversLicenseNumber",
        "DataType": "String"
    }
]
Name Description
Id (Integer) The identifier of the extension.
Name (String) The name of the extension.
DataType (String) The data type of the extension.

CustomerFull

The CustomerFull resource is a composition of a Customer resource together with all associated resources–Address, ContactMethod, CustomerExtension, Document, MemberOf, MergedCustomer, and RelatedCustomer, so that all associated information can be accessed from a single record. POST, GET, and DELETE are supported on CustomerFull resources. For example, you can use a POST request to the CustomerFull resource to create a full record in one operation.

Note that the CustomerFull resource simply aggregates information associated with a given customer. The identifier of the customer does not change between the Customer and CustomerFull records for a customer; that is, the customer identifier in the Customer resource and in the CustomerFull resource is the same in both cases.

PUT is not supported on CustomerFull resources. To modify the information, modify the constituent resources.

{
    "Addresses": [
        {
            "Id": "58ed9018-ae6e-4c8d-928c-3a0dec892aaf",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 2,
            "AddressType": "Home",
            "Default": false,
            "DoNotContact": true,
            "CountryCode": "AU",
            "Country": "Australia",
            "Locality": "JACKEYS MARSH",
            "StateCode": "TAS",
            "State": "Tasmania",
            "PostalCode": "7304",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "22 Jump St.",
            "StreetAddress2": "",
            "Notes": "",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        },
        {
            "Id": "b35c4b96-c31e-4409-a387-4bc2b5f593ea",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 3,
            "AddressType": "Shipping",
            "Default": true,
            "DoNotContact": false,
            "CountryCode": "CA",
            "Country": "Canada",
            "Locality": "Regina",
            "StateCode": "SK",
            "State": "Saskatchewan",
            "PostalCode": "S4S4S4",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "14 Fake St.",
            "StreetAddress2": "",
            "Notes": "sample string",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        }
    ],
    "ContactMethods": [
        {
            "Value": "sample@hotmail.com",
            "Id": "f9e625d5-552f-4860-aa18-0ff6c0cce0a5",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 1,
            "ContactMethodCategory": "Phone",
            "ContactMethodTypeId": 2,
            "ContactMethodType": "Work",
            "DoNotContact": true,
            "Default": true,
            "Notes": "",
            "Version": 1
        },
        {
            "Value": "sample_@hotmail.com",
            "Id": "69cb214b-1969-4be7-af61-91e40724f42e",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 1,
            "ContactMethodCategory": "Phone",
            "ContactMethodTypeId": 1,
            "ContactMethodType": "Home",
            "DoNotContact": true,
            "Default": false,
            "Notes": "",
            "Version": 1
        }
    ],
    "CustomerExtensions": [
        {
            "Value": "testorama",
            "Id": "9464628c-3f27-417c-bb2e-817125242f4d",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 3,
            "ExtensionType": "HashedPassword",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        },
        {
            "Value": "10",
            "Id": "8d30e9b5-e9a5-4c79-ac1c-9d223d3db8b1",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 1,
            "ExtensionType": "ShoeSize",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        }
    ],
    "RelatedCustomers": [],
    "MemberOf": [],
    "Documents": [],
    "MergedCustomers": [],
    "PrimaryName": "Tester",
    "Title": "Mr.",
    "AlternateName": "Spike",
    "MiddleName": "",
    "FamilyName": "Guy",
    "Notes": "",
    "Id": "c74ad127-a206-4e69-8c69-c4800bf34b71",
    "CustomerTypeId": 2,
    "CustomerType": "Person",
    "DateOfBirth": "2015-04-20T02:43:22.79",
    "PricingGroupId": null,
    "Disabled": false,
    "DoNotContact": false,
    "Version": 1,
    "MergedIntoCustomerId": null,
    "LastModifiedDateUtc": "2018-05-29T32:16:03",
    "UniqueIdentifier": null
}

For property definitions, see the Customer, Address, ContactMethod, CustomerExtension, Document, and MergedCustomer resources.

CustomerSearch

The CustomerSearch endpoint is an extension on the CustomerFull resource that allows you to search CustomerFull records for a string. (The CustomerFull resource itself does not support query filtering or direct search.) The CustomerSearch resource consists of a CustomerFull resource plus the Criteria field, which specifies the search string.

[
    {
       "Criteria": "spike",
       "Addresses": [
        {
            "Id": "58ed9018-ae6e-4c8d-928c-3a0dec892aaf",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 2,
            "AddressType": "Home",
            "Default": false,
            "DoNotContact": true,
            "CountryCode": "AU",
            "Country": "Australia",
            "Locality": "JACKEYS MARSH",
            "StateCode": "TAS",
            "State": "Tasmania",
            "PostalCode": "7304",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "22 Jump St.",
            "StreetAddress2": "",
            "Notes": "",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        },
        {
            "Id": "b35c4b96-c31e-4409-a387-4bc2b5f593ea",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 3,
            "AddressType": "Shipping",
            "Default": true,
            "DoNotContact": false,
            "CountryCode": "CA",
            "Country": "Canada",
            "Locality": "Regina",
            "StateCode": "SK",
            "State": "Saskatchewan",
            "PostalCode": "S4S4S4",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "14 Fake St.",
            "StreetAddress2": "",
            "Notes": "sample string",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        }
    ],
    "ContactMethods": [
        {
            "Value": "sample@hotmail.com",
            "Id": "f9e625d5-552f-4860-aa18-0ff6c0cce0a5",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 2,
            "ContactMethodCategory": "Email",
            "ContactMethodTypeId": 9,
            "ContactMethodType": "Home",
            "DoNotContact": true,
            "Default": true,
            "Notes": "",
            "Version": 1
        },
        {
            "Value": "sample_@hotmail.com",
            "Id": "69cb214b-1969-4be7-af61-91e40724f42e",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 2,
            "ContactMethodCategory": "Email",
            "ContactMethodTypeId": 10,
            "ContactMethodType": "Work",
            "DoNotContact": true,
            "Default": false,
            "Notes": "",
            "Version": 1
        }
    ],
    "CustomerExtensions": [
        {
            "Value": "testorama",
            "Id": "9464628c-3f27-417c-bb2e-817125242f4d",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 3,
            "ExtensionType": "HashedPassword",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        },
        {
            "Value": "10",
            "Id": "8d30e9b5-e9a5-4c79-ac1c-9d223d3db8b1",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 1,
            "ExtensionType": "ShoeSize",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        }
    ],
    "RelatedCustomers": [],
    "MemberOf": [],
    "Documents": [],
    "MergedCustomers": [],
    "PrimaryName": "Tester",
    "Title": "Mr.",
    "AlternateName": "Spike",
    "MiddleName": "",
    "FamilyName": "Guy",
    "Notes": "",
    "Id": "c74ad127-a206-4e69-8c69-c4800bf34b71",
    "CustomerTypeId": 2,
    "CustomerType": "Person",
    "DateOfBirth": "2015-04-20T02:43:22.79",
    "PricingGroupId": null,
    "Disabled": false,
    "DoNotContact": false,
    "Version": 1,
    "MergedIntoCustomerId": null,
    "LastModifiedDateUtc": "2018-05-29T32:16:03",
    "UniqueIdentifier": null
    }
]
Name Description
Criteria (String) The string you are searching for in customer records.

For information on remaining properties in the CustomerSearch resource, see the Address, ContactMethod, Customer, CustomerExtension, Document, MemberOf, MergedCustomer, and RelatedCustomer resources.

Document

The Document resource allows you to associate a file, such as a scan of a Driver’s License or a profile picture, with a customer.

{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "DocumentType": "ExternalCustomerId",
    "DocumentTypeId": 2,
    "Value": "66432",
    "Version": 1
}
Name Description
Id (GUID) The identifier of the document.
CustomerId (GUID) The identifier of the Customer associated with this document.
DocumentType (String) Read-only. A string representing the document type specified in DocumentTypeId.
DocumentTypeId (Integer) The code specifying the document type. For a list of supported document types, see DocumentTypeId.
DocumentClassification (String) Read-only. A string representing the document classification specified in DocumentClassificationId.
DocumentClassificationId (Integer) The code specifying the document classification. For a list of supported document classifications, see DocumentClassificationId.
Name (String) The document name.
MimeType (Integer) The mime type of the document. Supported formats are image/png and image/jpg.
Addedby (String) The name of the user who added the document.
DateAddedUtc (DateTime) The date the document was added, in UTC.
UpdatedBy (String) The name of the user who updated the document most recently.
DateUpdatedUtc (DateTime) The date the document was most recently updated, in UTC.
Href (String) The URL for retrieving the document.
PreviewHref (String) The URL for previewing an image document.

MemberOf

The MemberOf resource represents customers that are in a “parent” relationship to the current customer (the “child” customer).

Many-to-many relationships are permitted; for example, a customer can have many parents and/or many children. Note that designating A as the child of B is the same thing as designating B as the parent of A, and a parent/child relationship, once specified, will appear in both the MemberOf resource for customer A and the RelatedCustomers resource for customer B, regardless of the endpoint used to create the relationship. Note also that the system does not validate relationships; for example, nothing prevents a customer from being both a parent and a child of another customer. The system does prevent a customer from being designated as a parent or child of itself.


{
   "Id": "58a06e0e-30cd-4d84-b732-b906cca55f80",
   "ChildCustomerId": "20932241-cf42-42f7-9a6c-516514f802b7"
}

Name Description
Id (GUID) The identifier of the parent customer.
ChildCustomerId (GUID) The identifier of the current customer (who is the child of Id).

MergedCustomer

The MergedCustomer resource allows you to merge duplicate customer records into a single record.


{
   "MergedCustomerId": "58a06e0e-30cd-4d84-b732-b906cca55f80"
}

Name Description
MergedCustomerId (GUID) The identifier of a customer whose record has been merged into this record.

RelatedCustomer

The RelatedCustomer resource flags a given record as being in a “parent” relationship to some set of other customer records (“children” records).

Many-to-many relationships are permitted; for example, a customer can have many parents and/or many children. Note that designating A as the child of B is the same thing as designating B as the parent of A, and a parent/child relationship, once specified, will appear in both the MemberOf resource for customer A and the RelatedCustomers resource for customer B, regardless of the endpoint used to create the relationship. Note also that the system does not validate relationships; for example, nothing prevents a customer from being both a parent and a child of another customer. The system does prevent a customer from being designated as a parent or child of itself.


{
   "Id": "58a06e0e-30cd-4d84-b732-b906cca55f80",
   "ParentCustomerId": "20932241-cf42-42f7-9a6c-516514f802b7"
}

Name Description
Id (GUID) The identifier of the child customer.
ParentCustomerId (GUI) The identifier of the current customer (who is the parent of Id).

ENUMERATIONS

AddressType

AddressTypeId AddressType Description
1 None This address does not fit into any other category.
2 Home This address represents a home address.
3 Shipping This address represents a shipping address.
4 Office This address represents an office address.
5 Other This address represents an address of some other type.

ContactMethod Types and Categories

ContactMethodCategoryId ContactMethodCategory ContactMethodTypeId ContactMethodType
1 Phone 1 Home
1 Phone 3 Mobile
1 Phone 4 Company
1 Phone 5 Pager
1 Phone 6 Home Fax
1 Phone 7 Work Fax
1 Phone 8 Other
2 Email 9 Home
2 Email 10 Work
2 Email 11 Other
3 Other 12 Website
3 Other 13 Skype
3 Other 14 Twitter
3 Other 15 Facebook
3 Other 16 LinkedIn
3 Other 17 Other

CustomerType

CustomerTypeId CustomerType
1 None
2 Person
3 Company

DocumentClassification

DocumentClassificationId DocumentClassification
1 Unspecified
2 ID
3 Profile Photo
4 Other
5 Member Agreement Form
6 Medical Recommendation

DocumentType

DocumentTypeId DocumentType
1 PDF
2 JPEG
3 JPG
4 PNG

ExtensionType

ExtensionTypeId ExtensionType
CRM This extension type is available to all companies.
Dispensary This extension type is only available to companies that have been configured as dispensaries.

REQUESTS

GET All Customers

Retrieves a paginated list of customers for a company.

Request

GET /Companies({CompanyId})/Customers

Example Request

GET /Companies(14146)/Customers
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingAllCustomers()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingAllCustomers() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "Id": "659c2a38-d083-4421-9330-46d779702f85",
        "PrimaryName": "Princess",
        "MiddleName": "Ella",
        "FamilyName": "Jasmine",
        "AlternateName": "Jas",
        "CustomerType": "Company",
        "CustomerTypeId": 3,
        "DateOfBirth": "1952-07-23T12:00:00.000",
        "Disabled": true,
        "DoNotContact": true,
        "Notes": "Interested in iPhone 6",
        "Title": "Ms",
        "Version": 1
    }
]

A successful request returns a 200 (OK) response code listing information for all customers associated with the company included in the body of the response. For a description of parameters defined for the Customer resource, see Customer.

GET a Customer Record

Retrieves the record for a single customer.

Request

GET /Companies({CompanyId})/Customers({CustomerId})

Example Request

GET /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerType": "Company",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the record for the specified customer. For a description of parameters defined for the Customer resource, see Customer.

POST a Customer

Request

POST /Companies({CompanyId})/Customers

Example Request

POST /Companies(14146)/Customers
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms"
}'
static IRestResponse CreatingACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse CreatingACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.

Request Parameters

Name Description
CustomerTypeId (Integer) Required. The code for the customer type. For supported values, see CustomerTypeId.
PrimaryName (String) Optional. For a person, the first or given name. For an organization, business, or division, the full name.
MiddleName (String) Optional. The customer’s middle name.
FamilyName (String) Optional. The customer’s surname or last name.
AlternateName (String) Optional. The alias or preferred name for the customer (for example, “Bob” instead of “Robert”).
Title (String) Optional. The title to be used in customer salutations.
DateOfBirth (DateTime) Optional. The customer’s birth date, in UTC. You can use a full timestamp or shortened form (yyyy-mm-dd).
Disabled (Boolean) Optional. A flag indicating whether or not this customer is disabled. Deleting a customer acts as a Disable operation, as a Customer cannot be fully deleted. The default is false. When the Disabled flag is set to true, the Customer can still be retrieved and updated normally.
DoNotContact (Boolean) Optional. A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Optional. Any notes related to this customer.
UniqueIdentifier. (String) Optional. Maximum 100 characters. This identifier may either be directly set or not. If directly set, the identifier provided must be unique across the associated company. If not set, the system automatically generates an identifier that is unique across the company. Unique identifiers are case-insensitive.

Response

Example Response

HTTP 201 Content-Type: application/json

A successful request returns a 201 (Created) response code along with the newly created customer record, including the generated identifier for the customer. For a description of parameters defined for the Customer resource, see Customer.

PUT a Customer

Modifies an existing customer record.

Request

PUT /Companies({CompanyId})/Customers({CustomerId})

Example Request

PUT /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms"
}
curl -X PUT "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms"
}'
static IRestResponse UpdatingACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
    var request = new RestRequest(Method.PUT);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"659c2a38-d083-4421-9330-46d779702f85\",\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse UpdatingACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPut request = new HttpPut("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"659c2a38-d083-4421-9330-46d779702f85\",\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"659c2a38-d083-4421-9330-46d779702f85\",\"PrimaryName\":\"Princess\",\"MiddleName\":\"Ella\",\"FamilyName\":\"Jasmine\",\"AlternateName\":\"Jas\",\"CustomerTypeId\":3,\"DateOfBirth\":\"1952-07-23T12:00:00.000\",\"Disabled\":true,\"DoNotContact\":true,\"Notes\":\"Interested in iPhone 6\",\"Title\":\"Ms\"}";

response = RestClient.put 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

Name Description
Id (GUID) Required. The customer identifier.
CustomerTypeId (Integer) Required. The code for the customer type. For supported values, see CustomerTypeId.
PrimaryName (String) Optional. For a person, the first or given name. For an organization, business, or division, the full name.
MiddleName (String) Optional. The customer’s middle name.
FamilyName (String) Optional. The customer’s surname or last name.
AlternateName (String) Optional. The alias or preferred name for the customer.
Title (String) Optional. The title to be used in customer salutations.
DateOfBirth (DateTime) Optional. The customer’s birth date, in UTC. You can use a full timestamp or shortened form (yyyy-mm-dd).
Disabled (Boolean) Optional. A flag indicating whether or not this customer is disabled. Deleting a customer is interpreted as a Disable operation, as a customer record cannot be fully deleted. The default is false. When the Disabled flag is set to true, the customer can still be retrieved and updated normally.
DoNotContact (Boolean) Optional. A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Optional. Any notes related to this customer.
UniqueIdentifier. (String) Optional. Maximum 100 characters. This identifier may either be directly set or not. If directly set, the identifier provided must be unique across the associated company. If not set, the system automatically generates an identifier that is unique across the company. Unique identifiers are case-insensitive.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "AlternateName": "Jas",
    "CustomerType": "Company",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms",
    "Version": 2
}

A successful request returns a 200 (OK) response code along with the updated customer record. For a description of parameters defined for the Customer resource, see Customer.

DELETE a Customer

Disables a customer record. Note that a customer record is never fully deleted (and cannot be), but only disabled.

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})

Example Request

DELETE /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse DeletingACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse DeletingACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

GET All Customer Addresses

Retrieves all the addresses associated with a customer.

Request

GET /Companies({CompanyId})/Customers({CustomerId})/Addresses

Example Request

GET /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingAllAddressesForACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingAllAddressesForACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
        "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
        "AddressType": "Home",
        "AddressTypeId": 2,
        "AttentionTo": "Princess",
        "Country": "Canada",
        "CountryCode": "CA",
        "Default": false,
        "DoNotContact": true,
        "Email": "Jas@princess.ca",
        "Locality": "Mountain View",
        "Notes": "Moved as of April 15 2015",
        "Phone": "(555) 555-5555",
        "PostalCode": "94043",
        "PostOfficeBoxNumber": "P.O. Box 1022",
        "State": "Alberta",
        "StateCode": "AB",
        "StreetAddress1": "1600 Amphitheatre Pkwy",
        "StreetAddress2": "Suite 500",
        "Version": 1
    }
]

A successful request returns a 200 (OK) response code along with an array of the Address resources associated with the specified customer. For a description of parameters defined for the Address resource, see Address.

GET a Specific Customer Address

Retrieves a specific address for a customer.

Request

GET /Companies({CompanyId})/Customers({CustomerId})/Addresses({AddressId})

Example Request

GET /Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingACustomerAddress()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingACustomerAddress() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
AddressId (GUID) Required. The address identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressType": "Home",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "Country": "Canada",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "State": "Alberta",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the requested address record. For a description of parameters defined for the Address resource, see Address.

POST a Customer Address

Creates an address entry for a customer.

Request

POST /Companies({CompanyId})/Customers({CustomerId})/Addresses

Example Request

POST /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500"
}'
static IRestResponse AddingACustomerAddress()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse AddingACustomerAddress() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/Addresses', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.

Request Parameters

Name Description
CustomerId (GUID) Required. The customer associated with this address.
AddressTypeId (Integer) Required. The code for the address type. For supported values, see AddressTypeId.
CountryCode (String) Required. The ISO 3166-2 alpha-2 code for the country where this address is located. To see the list of these codes, see Getting All Countries.
StateCode (String(2)) Required. The ISO 3166-2 alpha-2 Region code for the state or province where this address resides. To see a list of these codes, see Getting All Countries. The provided state code must be a legitimate state, province, or region for the country specified by CountryCode.
AttentionTo (String) Optional. The name of the person or department residing at this address.
Default (Boolean) Optional. A flag indicating whether this address is the default address for the customer.
DoNotContact (Boolean) Optional. A flag indicating whether this address is private and not to be used by any external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Email (String) Optional. The contact email for this address. The email format is validated, but the email address is not verified.
Locality (String) Optional. The locality (for example, city, town, or hamlet) of this address.
Notes (String) Optional. Any notes related to this address.
Phone (String) Optional. The contact phone number for this address.
PostalCode (String) Optional. The postal code/zip code for this address. If provided, it must be a valid postal/zip code for the country specified by CountryCode.
PostOfficeBoxNumber (String) Optional. The post office box number for this address.
StreetAddress1 (String) Optional. Line 1 of the street address.
StreetAddress2 (String) Optional. Line 2 of the street address.

Response

Example Response

HTTP 201 Content-Type: application/json

A successful request returns a 201 (Created) response code along with the newly created address record, including the generated identifier for the address. For a description of parameters defined for the Address resource, see Address.

PUT a Customer Address

Modifies a customer address.

Request

PUT /Companies({CompanyId})/Customers({CustomerId})/Addresses({AddressId})

Example Request

PUT /Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500"
}
curl -X PUT "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "Country": "Canada",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "State": "Alberta",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500"
}'
static IRestResponse UpdatingACustomerAddress()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
    var request = new RestRequest(Method.PUT);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"a08b0640-606a-41f0-901a-facaf50e75dd\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressType\":\"Home\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"Country\":\"Canada\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"State\":\"Alberta\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse UpdatingACustomerAddress() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPut request = new HttpPut("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"a08b0640-606a-41f0-901a-facaf50e75dd\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressType\":\"Home\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"Country\":\"Canada\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"State\":\"Alberta\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"a08b0640-606a-41f0-901a-facaf50e75dd\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"AddressType\":\"Home\",\"AddressTypeId\":2,\"AttentionTo\":\"Princess\",\"Country\":\"Canada\",\"CountryCode\":\"CA\",\"Default\":false,\"DoNotContact\":true,\"Email\":\"Jas@princess.ca\",\"Locality\":\"Mountain View\",\"Notes\":\"Moved as of April 15 2015\",\"Phone\":\"(555) 555-5555\",\"PostalCode\":\"94043\",\"PostOfficeBoxNumber\":\"P.O. Box 1022\",\"State\":\"Alberta\",\"StateCode\":\"AB\",\"StreetAddress1\":\"1600 Amphitheatre Pkwy\",\"StreetAddress2\":\"Suite 500\"}";

response = RestClient.put 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer associated with the address.
AddressId (GUID) Required. The address identifier.

Request Parameters

Name Description
Id (GUID) Required. The address identifier.
CustomerId (GUID) Required. The identifier of the Customer associated with this address.
AddressTypeId (Integer) Required. The code for the address type. For supported values, see AddressTypeId.
CountryCode (String) Required. The ISO 3166-2 alpha-2 code for the country where this address is located. To see the list of these codes, see Getting All Countries.
StateCode (String(2)) Required. The ISO 3166-2 alpha-2 Region code for the state or province where this address resides. To see a list of these codes, see Getting All Countries. The state code must actually belong to the specified country.
AttentionTo (String) Optional. The name of the person or department residing at this address.
Default (Boolean) Optional. A flag indicating whether this address is the default address for the customer.
DoNotContact (Boolean) Optional. A flag indicating whether this address is private and not to be used by any external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Email (String) Optional. The contact email for this address. If provided, the format of the address must be valid.
Locality (String) Optional. The locality (for example, city, town, or hamlet) of this address.
Notes (String) Optional. Any notes related to this address.
Phone (String) Optional. The contact phone number for this address.
PostalCode (String) Optional. The postal code/zip code for this address.
PostOfficeBoxNumber (String) Optional. The post office box number for this address.
StreetAddress1 (String) Optional. Line 1 of the street address.
StreetAddress2 (String) Optional. Line 2 of the street address.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "AddressType": "Home",
    "AddressTypeId": 2,
    "AttentionTo": "Princess",
    "Country": "Canada",
    "CountryCode": "CA",
    "Default": false,
    "DoNotContact": true,
    "Email": "Jas@princess.ca",
    "Locality": "Mountain View",
    "Notes": "Moved as of April 15 2015",
    "Phone": "(555) 555-5555",
    "PostalCode": "94043",
    "PostOfficeBoxNumber": "P.O. Box 1022",
    "State": "Alberta",
    "StateCode": "AB",
    "StreetAddress1": "1600 Amphitheatre Pkwy",
    "StreetAddress2": "Suite 500",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with a copy of the modified address record. For a description of parameters defined for the Address resource, see Address.

DELETE a Customer Address

Deletes an address from the customer record.

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})/Addresses({AddressId})

Example Request

DELETE /Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse RemovingAnAddressFromACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse RemovingAnAddressFromACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(902cdc91-65f4-4c7d-b336-5f291849f2fe)/Addresses(a08b0640-606a-41f0-901a-facaf50e75dd)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer associated with the address.
AddressId (GUID) Required. The address identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

GET All Customer Extension Types

Retrieves the list of extensions that have been defined for customer records. This list is implemented and maintained by iQmetrix (so, for example, POST, PUT, and DELETE are not supported for this endpoint).

Request

GET /Companies({CompanyId})/CustomerExtensionTypes

Example Request

GET /Companies(14146)/CustomerExtensionTypes
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerExtensionTypes" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingAllCustomerExtensionTypes()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerExtensionTypes");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 


    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingAllCustomerExtensionTypes() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerExtensionTypes");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerExtensionTypes', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "Id": 1,
        "Name": "ShoeSize",
        "DataType": "float"
    },
    {
        "Id": 2,
        "Name": "CorrelationId",
        "DataType": "string"
    },
    {
        "Id": 3,
        "Name": "HashedPassword",
        "DataType": "string"
    }
]

A successful request returns a 200 (OK) response code along with the list of defined customer extension types. For a description of parameters defined for the CustomerExtensionType resource, see CustomerExtensionType.

GET a Customer Extension

Retrieves the value of a custom property set for a given customer.

Request

GET /Companies({CompanyId})/Customers({CustomerId})/CustomerExtensions({CustomerExtensionId})

Example Request

GET /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingACustomerExtension()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingACustomerExtension() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
CustomerExtensionId (GUID) Required. The identifier of the CustomerExtension.

Request Parameters

None.

Response Parameters

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionType": "ExternalCustomerId",
    "ExtensionTypeId": 2,
    "Value": "66432",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the customer extension record. For a description of parameters defined for the CustomerExtension resource, see CustomerExtension.

POST a Customer Extension

Sets the value of an extension property (CustomerExtensionType) for a given customer.

Request

POST /Companies({CompanyId})/Customers({CustomerId})/CustomerExtensions

Example Request

POST /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionTypeId": 2,
    "Value": "66432"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionTypeId": 2,
    "Value": "66432"
}'
static IRestResponse CreatingACustomerExtension()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse CreatingACustomerExtension() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

Name Description
ExtensionTypeId (Integer) Required. The identifier of the extension type. For supported values, see ExtensionTypeId.
Value (String) Optional. The value to set for the custom property. If not set, the value is set to null.

Response

Example Response

HTTP 201 Content-Type: application/json
{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionType": "ExternalCustomerId",
    "ExtensionTypeId": 2,
    "ExtensionTypeFeature": "CRM",
    "Value": "66432",
    "Version": 1
}

A successful request returns a 201 (Created) response code along with the newly defined customer extension. For a description of parameters defined for the CustomerExtension resource, see CustomerExtension.

PUT a Customer Extension

Modifies the value of a custom property for a customer.

Request

PUT /Companies({CompanyId})/Customers({CustomerId})/CustomerExtensions({CustomerExtensionId})

Example Request

PUT /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionTypeId": 2,
    "Value": "66432"
}
curl -X PUT "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionTypeId": 2,
    "Value": "66432"
}'
static IRestResponse UpdatingACustomerExtension()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
    var request = new RestRequest(Method.PUT);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"74b87ece-5f70-454d-9991-7952127146b0\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse UpdatingACustomerExtension() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPut request = new HttpPut("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"74b87ece-5f70-454d-9991-7952127146b0\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"74b87ece-5f70-454d-9991-7952127146b0\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ExtensionTypeId\":2,\"Value\":\"66432\"}";

response = RestClient.put 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
CustomerExtensionId (GUID) Required. The identifier of the CustomerExtension.

Request Parameters

Name Description
Id (GUID) Required. The identifier of the extension.
CustomerId (GUID) Required. The identifier of the Customer.
ExtensionTypeId (Integer) Required. The identifier of the extension type. For supported values, see ExtensionTypeId.
Value (String) Optional. The new value for the custom property.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "74b87ece-5f70-454d-9991-7952127146b0",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ExtensionType": "ExternalCustomerId",
    "ExtensionTypeId": 2,
    "Value": "66432",
    "Version": 1
}

A successful request returns a 200 (OK) response code with updated customer extension record. For a description of parameters defined for the CustomerExtension resource, see CustomerExtension.

DELETE a Customer Extension

Deletes a custom property for a given customer.

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})/CustomerExtensions({CustomerExtensionId})

Example Request

DELETE /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse DeletingACustomerExtension()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse DeletingACustomerExtension() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/CustomerExtensions(74b87ece-5f70-454d-9991-7952127146b0)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
CustomerExtensionId (GUID) Required. The identifier of the CustomerExtension.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

GET All Contact Methods for a Customer

Request

GET /Companies({CompanyId})/Customers({CustomerId})/ContactMethods

Example Request

GET /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingAllContactMethodsForACustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingAllContactMethodsForACustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The identifier of the Customer.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
        "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
        "ContactMethodCategory": "Email",
        "ContactMethodCategoryId": 1,
        "ContactMethodType": "Work phone",
        "ContactMethodTypeId": 5,
        "Default": true,
        "DoNotContact": true,
        "Notes": "After 6pm",
        "Value": "(306) 222-3333",
        "Version": 1
    }
]

A successful request returns a 200 (OK) response code along with a list of all recorded contact methods. For a description of parameters defined for the ContactMethod resource, see ContactMethod.

GET a Customer Contact Method

Request

GET /Companies({CompanyId})/Customers({CustomerId})/ContactMethods({ContactMethodId})

Example Request

GET /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingACustomerContactMethod()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingACustomerContactMethod() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
ContactMethodId (GUID) Required. The identifier of the ContactMethod.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategory": "Email",
    "ContactMethodCategoryId": 2,
    "ContactMethodType": "Work",
    "ContactMethodTypeId": 10,
    "Default": true,
    "DoNotContact": true,
    "Notes": "",
    "Value": "fredericab@example.com",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the requested contact method record. For a description of parameters defined for the ContactMethod resource, see ContactMethod.

POST a Customer Contact Method

Request

POST /Companies({CompanyId})/Customers({CustomerId})/ContactMethods

Example Request

POST /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategoryId": 1,
    "ContactMethodTypeId": 3,
    "Default": true,
    "DoNotContact": true,
    "Notes": "After 6pm",
    "Value": "(306) 222-3333"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategoryId": 1,
    "ContactMethodTypeId": 3,
    "Default": true,
    "DoNotContact": true,
    "Notes": "After 6pm",
    "Value": "(306) 222-3333"
}'
static IRestResponse AddingACustomerContactMethod()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":1,\"ContactMethodTypeId\":3,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"(306) 222-3333\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse AddingACustomerContactMethod() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":1,\"ContactMethodTypeId\":3,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"(306) 222-3333\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":1,\"ContactMethodTypeId\":3,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"(306) 222-3333\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The identifier of the Customer.

Request Parameters

Name Description
CustomerId (GUID) Required. The identifier of the Customer associated with the contact method.
ContactMethodCategoryId (Integer) Required. The numeric code for the contact method category. For a list of supported types and categories, see ContactMethod Types and Categories.
ContactMethodTypeId (Integer) Required. The code representing the contact method type. For a list of supported types and categories, see ContactMethod Types and Categories.
Default (Boolean) Optional. A flag indicating whether this is the default contact method for the customer.
DoNotContact (Boolean) Optional. A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Optional. Notes related to this contact method.
Value (String) Optional. The information for that contact method: for example, the actual email address or phone number. Email addresses are validated (but not verified).

Response

Example Response

HTTP 201 Content-Type: application/json

A successful request returns a 201 (Created) response code along with the newly created contact method record, including the generated identifier for the contact method. For a description of parameters defined for the ContactMethod resource, see ContactMethod.

PUT a Customer Contact Method

Modifies a customer contact method.

Request

PUT /Companies({CompanyId})/Customers({CustomerId})/ContactMethods({ContactMethodId})

Example Request

PUT /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategoryId": 2,
    "ContactMethodTypeId": 10,
    "Default": true,
    "DoNotContact": true,
    "Notes": "",
    "Value": "fredericab@example.com",
    "Version": 1
}
curl -X PUT "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategoryId": 2,
    "ContactMethodTypeId": 10,
    "Default": true,
    "DoNotContact": true,
    "Notes": "",
    "Value": "fredericab@example.com",
    "Version": 1
}'
static IRestResponse UpdatingACustomerContactMethod()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
    var request = new RestRequest(Method.PUT);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"b25dd8b2-a24d-4107-8fbe-9c7b21e18137\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":2,\"ContactMethodTypeId\":10,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"fredericab@example.com\",\"Version\":1}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse UpdatingACustomerContactMethod() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPut request = new HttpPut("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"b25dd8b2-a24d-4107-8fbe-9c7b21e18137\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":2,\"ContactMethodTypeId\":10,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"fredericab@example.com\",\"Version\":1}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"b25dd8b2-a24d-4107-8fbe-9c7b21e18137\",\"CustomerId\":\"659c2a38-d083-4421-9330-46d779702f85\",\"ContactMethodCategoryId\":2,\"ContactMethodTypeId\":10,\"Default\":true,\"DoNotContact\":true,\"Notes\":\"After 6pm\",\"Value\":\"fredericab@example.com\",\"Version\":1}";

response = RestClient.put 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
ContactMethodId (GUID) Required. The identifier of the ContactMethod.

Request Parameters

Name Description
Id (GUID) Required. The identifier of the contact method.
CustomerId (GUID) Required. The identifier of the Customer associated with the contact method.
ContactMethodCategoryId (Integer) Required. The numeric code for the contact method category. For a list of supported types and categories, see ContactMethod Types and Categories.
ContactMethodTypeId (Integer) Required. The code representing the contact method type. For a list of supported types and categories, see ContactMethod Types and Categories.
Default (Boolean) Optional. A flag indicating whether this is the default contact method for the customer.
DoNotContact (Boolean) Optional. A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Optional. Notes related to this contact method.
Value (String) Optional. The information for that contact method: for example, the actual email address or phone number. Email addresses are validated (but not verified).

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
    "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
    "ContactMethodCategory": "Email",
    "ContactMethodCategoryId": 2,
    "ContactMethodType": "Work",
    "ContactMethodTypeId": 10,
    "Default": true,
    "DoNotContact": true,
    "Notes": "After 6pm",
    "Value": "fredericab@example.com",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the updated contact method record. For a description of parameters defined for the ContactMethod resource, see ContactMethod.

DELETE a Customer Contact Method

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})/ContactMethods({ContactMethodId})

Example Request

DELETE /Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse RemovingACustomerContactMethod()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse RemovingACustomerContactMethod() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(659c2a38-d083-4421-9330-46d779702f85)/ContactMethods(0c877e33-e0a4-46ca-be34-49718f29e791)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the Customer.
ContactMethodId (GUID) Required. The identifier of the ContactMethod.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

GET a CustomerFull Record

A CustomerFull record includes all the information captured for a given customer. Retrieving the CustomerFull record for a customer provides an easy way of viewing all important information for a customer.

Note that the CustomerFull endpoint supports retrieving only one record at a time; that is, GET /Companies({CompanyId})/CustomerFull is not supported.

Request

GET /Companies({CompanyId})/CustomerFull({CustomerId})

Example Request

GET /Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse GettingAFullCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse GettingAFullCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "659c2a38-d083-4421-9330-46d779702f85",
    "PrimaryName": "Princess",
    "MiddleName": "Ella",
    "FamilyName": "Jasmine",
    "Addresses": [
        {
            "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
            "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
            "AddressType": "Home",
            "AddressTypeId": 2,
            "AttentionTo": "Princess",
            "Country": "Canada",
            "CountryCode": "CA",
            "Default": false,
            "DoNotContact": true,
            "Email": "Jas@princess.ca",
            "Locality": "Mountain View",
            "Notes": "Moved as of April 15 2015",
            "Phone": "(555) 555-5555",
            "PostalCode": "94043",
            "PostOfficeBoxNumber": "P.O. Box 1022",
            "State": "Alberta",
            "StateCode": "AB",
            "StreetAddress1": "1600 Amphitheatre Pkwy",
            "StreetAddress2": "Suite 500",
            "Version": 1
        }
    ],
    "AlternateName": "Jas",
    "ContactMethods": [
        {
            "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
            "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
            "ContactMethodCategory": "Phone",
            "ContactMethodCategoryId": 1,
            "ContactMethodType": "Work",
            "ContactMethodTypeId": 2,
            "Default": true,
            "DoNotContact": true,
            "Notes": "After 6pm",
            "Value": "(306) 222-3333",
            "Version": 1
        }
    ],
    "CustomerExtensions": [
        {
            "Id": "74b87ece-5f70-454d-9991-7952127146b0",
            "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
            "ExtensionType": "ExternalCustomerId",
            "ExtensionTypeId": 2,
            "Value": "66432",
            "Version": 1
        }
    ],
    "CustomerType": "Company",
    "CustomerTypeId": 3,
    "DateOfBirth": "1952-07-23T12:00:00.000",
    "Disabled": true,
    "DoNotContact": true,
    "Notes": "Interested in iPhone 6",
    "Title": "Ms",
    "Version": 1
}

A successful request returns a 200 (OK) response code along with the complete customer record, including address, contact information, and customer extension information. For a description of parameters defined for the CustomerFull resource, see CustomerFull.

POST a CustomerFull Record

A CustomerFull record includes all the information captured for a given customer. POSTing a CustomerFull record provides an easy way of specifying all related information for a customer at once. Note that PUT is not supported on CustomerFull resources (for example, to update an address). To modify a customer record, PUT to the endpoint of the constituent resource (for example, the Address resource).

Request

POST /Companies({CompanyId})/CustomerFull

Example Request

POST /Companies(14146)/CustomerFull
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
  "Addresses": [
    {
      "AddressTypeId": 3,
      "Default": true,
      "DoNotContact": false,
      "CountryCode": "CA",
      "Locality": "Regina",
      "StateCode": "SK",
      "PostalCode": "S4S 4S4",
      "StreetAddress1": "14 Fake St.",
      "Notes": "sample string"
    },
    {
      "AddressTypeId": 2,
      "Default": false,
      "DoNotContact": true,
      "CountryCode": "AU",
      "Locality": "JACKEYS MARSH",
      "StateCode": "TAS",
      "PostalCode": "7304",
      "StreetAddress1": "22 Jump St."
    }
  ],
  "ContactMethods": [
    {
      "ContactMethodCategoryId": 1,
      "ContactMethodTypeId": 3,
      "Value": "604-324-5587",
      "DoNotContact": true,
      "Default": true
    },
    {
      "ContactMethodCategoryId": 2,
      "ContactMethodTypeId": 9,
      "Value": "sample_@example.com",
      "DoNotContact": true,
      "Default": false
    }
  ],
  "CustomerExtensions": [
    {
      "Value": "10",
      "ExtensionTypeId": 1
    },
    {
      "Value": "testorama",
      "ExtensionTypeId": 3
    }
  ],
  "CustomerTypeId": 2,
  "Title": "Mr.",
  "PrimaryName": "Tester",
  "AlternateName": "Spike",
  "MiddleName": "",
  "FamilyName": "Guy",
  "DateOfBirth": "2015-04-20T02:43:22.789616+00:00",
  "Notes": "",
  "Disabled": false,
  "DoNotContact": false
}
curl -X POST \
  https://crmint.iqmetrix.net/v1/Companies%2899225%29/CustomerFull \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdCE5XSEBLiU9EVgYdTteVDUAMgENbg4kCx8KHS9vUTwtZgQbJBI-BXRvWiIIHiUkDGIJDzQiL180' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: b062476a-fcdd-f57d-f5dd-0def759651d0' \
  -d '{
  "Addresses": [
    {
      "AddressTypeId": 3,
      "Default": true,
      "DoNotContact": false,
      "CountryCode": "CA",
      "Locality": "Regina",
      "StateCode": "SK",
      "PostalCode": "S4S 4S4",
      "StreetAddress1": "14 Fake St.",
      "Notes": "sample string"
    },
    {
      "AddressTypeId": 2,
      "Default": false,
      "DoNotContact": true,
      "CountryCode": "AU",
      "Locality": "JACKEYS MARSH",
      "StateCode": "TAS",
      "PostalCode": "7304",
      "StreetAddress1": "22 Jump St."
    }
  ],
  "ContactMethods": [
    {
      "ContactMethodCategoryId": 1,
      "ContactMethodTypeId": 3,
      "Value": "sample@hotmail.com",
      "DoNotContact": true,
      "Default": true
    },
    {
      "ContactMethodCategoryId": 2,
      "ContactMethodTypeId": 9,
      "Value": "sample_@hotmail.com",
      "DoNotContact": true,
      "Default": false
    }
  ],
  "CustomerExtensions": [
    {
      "Value": "10",
      "ExtensionTypeId": 1
    },
    {
      "Value": "testorama",
      "ExtensionTypeId": 3
    }
  ],
  "CustomerTypeId": 2,
  "Title": "Mr.",
  "PrimaryName": "Tester",
  "AlternateName": "Spike",
  "MiddleName": "",
  "FamilyName": "Guy",
  "DateOfBirth": "2015-04-20T02:43:22.789616+00:00",
  "Notes": "",
  "Disabled": false,
  "DoNotContact": false
}'
static IRestResponse CreateAFullCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "91472c49-aced-7e59-b829-2ef93fa17a06");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC");
request.AddParameter("undefined", "{\"Addresses\": [{\"AddressTypeId\": 3,\"Default\": true,\"DoNotContact\": false,\"CountryCode\": \"CA\",\"Locality\": \"Regina\",\"StateCode\": \"SK\",\"PostalCode\": \"S4S 4S4\",\"StreetAddress1\": \"14 Fake St.\",\"Notes\": \"sample string\"},{\"AddressTypeId\": 2,\"Default\": false,\"DoNotContact\": true,\"CountryCode\": \"AU\",\"Locality\": \"JACKEYS MARSH\",\"StateCode\": \"TAS\",\"PostalCode\": \"7304\",\"StreetAddress1\": \"22 Jump St.\"}],\"ContactMethods\": [{\"ContactMethodCategoryId\": 1,\"ContactMethodTypeId\": 3,\"Value\": \"604-324-5587\",\"DoNotContact\": true,\"Default\": true},{\"ContactMethodCategoryId\": 2,\"ContactMethodTypeId\": 9,\"Value\": \"sample_@hotmail.com\",\"DoNotContact\": true,\"Default\": false}],\"CustomerExtensions\": [{\"Value\": \"10\",\"ExtensionTypeId\": 1},{\"Value\": \"testorama\",\"ExtensionTypeId\": 3}],\"CustomerTypeId\": 2,\"Title\": \"Mr.\",\"PrimaryName\": \"Tester\",\"AlternateName\": \"Spike\",\"MiddleName\": \"\",\"FamilyName\": \"Guy\",\"DateOfBirth\": \"2015-04-20T02:43:22.789616+00:00\",\"Notes\": \"\",\"Disabled\": false,\"DoNotContact\": false}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse CreatingAFullCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Addresses\": [{\"AddressTypeId\": 3,\"Default\": true,\"DoNotContact\": false,\"CountryCode\": \"CA\",\"Locality\": \"Regina\",\"StateCode\": \"SK\",\"PostalCode\": \"S4S 4S4\",\"StreetAddress1\": \"14 Fake St.\",\"Notes\": \"sample string\"},{\"AddressTypeId\": 2,\"Default\": false,\"DoNotContact\": true,\"CountryCode\": \"AU\",\"Locality\": \"JACKEYS MARSH\",\"StateCode\": \"TAS\",\"PostalCode\": \"7304\",\"StreetAddress1\": \"22 Jump St.\"}],\"ContactMethods\": [{\"ContactMethodCategoryId\": 1,\"ContactMethodTypeId\": 3,\"Value\": \"604-324-5587\",\"DoNotContact\": true,\"Default\": true},{\"ContactMethodCategoryId\": 2,\"ContactMethodTypeId\": 9,\"Value\": \"sample_@hotmail.com\",\"DoNotContact\": true,\"Default\": false}],\"CustomerExtensions\": [{\"Value\": \"10\",\"ExtensionTypeId\": 1},{\"Value\": \"testorama\",\"ExtensionTypeId\": 3}],\"CustomerTypeId\": 2,\"Title\": \"Mr.\",\"PrimaryName\": \"Tester\",\"AlternateName\": \"Spike\",\"MiddleName\": \"\",\"FamilyName\": \"Guy\",\"DateOfBirth\": \"2015-04-20T02:43:22.789616+00:00\",\"Notes\": \"\",\"Disabled\": false,\"DoNotContact\": false}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Addresses\": [{\"AddressTypeId\": 3,\"Default\": true,\"DoNotContact\": false,\"CountryCode\": \"CA\",\"Locality\": \"Regina\",\"StateCode\": \"SK\",\"PostalCode\": \"S4S 4S4\",\"StreetAddress1\": \"14 Fake St.\",\"Notes\": \"sample string\"},{\"AddressTypeId\": 2,\"Default\": false,\"DoNotContact\": true,\"CountryCode\": \"AU\",\"Locality\": \"JACKEYS MARSH\",\"StateCode\": \"TAS\",\"PostalCode\": \"7304\",\"StreetAddress1\": \"22 Jump St.\"}],\"ContactMethods\": [{\"ContactMethodCategoryId\": 1,\"ContactMethodTypeId\": 3,\"Value\": \"604-324-5587\",\"DoNotContact\": true,\"Default\": true},{\"ContactMethodCategoryId\": 2,\"ContactMethodTypeId\": 9,\"Value\": \"sample_@hotmail.com\",\"DoNotContact\": true,\"Default\": false}],\"CustomerExtensions\": [{\"Value\": \"10\",\"ExtensionTypeId\": 1},{\"Value\": \"testorama\",\"ExtensionTypeId\": 3}],\"CustomerTypeId\": 2,\"Title\": \"Mr.\",\"PrimaryName\": \"Tester\",\"AlternateName\": \"Spike\",\"MiddleName\": \"\",\"FamilyName\": \"Guy\",\"DateOfBirth\": \"2015-04-20T02:43:22.789616+00:00\",\"Notes\": \"\",\"Disabled\": false,\"DoNotContact\": false}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.

Request Parameters

Name Description
CustomerTypeId (Integer) Required. The code for the customer type. For supported values, see CustomerTypeId.
PrimaryName (String) Optional. For a person, the first or given name. For an organization, business, or division, the full name. Maximum 100 characters.
MiddleName (String) Optional. The customer’s middle name. Maximum 50 characters.
FamilyName (String) Optional. The customer’s surname or last name. Maximum 100 characters.
AlternateName (String) Optional. The alias or preferred name for the customer. Maximum 50 characters.
Title (String) Optional. The title to be used in customer salutations. Maximum 50 characters.
DateOfBirth (DateTime) Optional. The customer’s birth date, in UTC. You can use a full timestamp or shortened form (yyyy-mm-dd).
PricingGroupId (Integer) Optional. The identifier of the pricing group the customer belongs to. This identifier hs validated on create and update.
Disabled (Boolean) Optional. A flag indicating whether or not this customer is disabled. Deleting a customer acts as a Disable operation, as a Customer cannot be fully deleted. The default is false. When the Disabled flag is set to true, the Customer can still be retrieved and updated normally. Filterable.
DoNotContact (Boolean) Optional. A flag indicating this customer is private; that is, it is not to be used by external systems (such as a marketing system). If not provided when the record is created, this field is set to true.
Notes (String) Optional. Any notes related to this customer. Maximum 2000 characters.
Addresses (Array[Address]) Optional. The Address resource in CustomerFull records is as for other cases, except that CustomerId is not specified.
ContactMethods (Array[ContactMethod]) Optional. The ContactMethod resource for CustomerFull records is as in other cases, except that CustomerId is not specified.
CustomerExtensions (Array[CustomerExtension]) Optional. The CustomerExtension resource in CustomerFull records is as for other cases, except that CustomerId is not specified.

Response

Example Response

HTTP 201 Content-Type: application/json
{
    "Addresses": [
        {
            "Id": "58ed9018-ae6e-4c8d-928c-3a0dec892aaf",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 2,
            "AddressType": "Home",
            "Default": false,
            "DoNotContact": true,
            "CountryCode": "AU",
            "Country": "Australia",
            "Locality": "JACKEYS MARSH",
            "StateCode": "TAS",
            "State": "Tasmania",
            "PostalCode": "7304",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "22 Jump St.",
            "StreetAddress2": "",
            "Notes": "",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        },
        {
            "Id": "b35c4b96-c31e-4409-a387-4bc2b5f593ea",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "AddressTypeId": 3,
            "AddressType": "Shipping",
            "Default": true,
            "DoNotContact": false,
            "CountryCode": "CA",
            "Country": "Canada",
            "Locality": "Regina",
            "StateCode": "SK",
            "State": "Saskatchewan",
            "PostalCode": "S4S4S4",
            "PostOfficeBoxNumber": "",
            "StreetAddress1": "14 Fake St.",
            "StreetAddress2": "",
            "Notes": "sample string",
            "Version": 1,
            "AttentionTo": "",
            "Phone": "",
            "Email": ""
        }
    ],
    "ContactMethods": [
        {
            "Value": "604-324-5587",
            "Id": "f9e625d5-552f-4860-aa18-0ff6c0cce0a5",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 1,
            "ContactMethodCategory": "Phone",
            "ContactMethodTypeId": 3,
            "ContactMethodType": "Mobile",
            "DoNotContact": true,
            "Default": true,
            "Notes": "",
            "Version": 1
        },
        {
            "Value": "sample_@hotmail.com",
            "Id": "69cb214b-1969-4be7-af61-91e40724f42e",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ContactMethodCategoryId": 2,
            "ContactMethodCategory": "Email",
            "ContactMethodTypeId": 9,
            "ContactMethodType": "Home",
            "DoNotContact": true,
            "Default": false,
            "Notes": "",
            "Version": 1
        }
    ],
    "CustomerExtensions": [
        {
            "Value": "testorama",
            "Id": "9464628c-3f27-417c-bb2e-817125242f4d",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 3,
            "ExtensionType": "HashedPassword",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        },
        {
            "Value": "10",
            "Id": "8d30e9b5-e9a5-4c79-ac1c-9d223d3db8b1",
            "CustomerId": "c74ad127-a206-4e69-8c69-c4800bf34b71",
            "ExtensionTypeId": 1,
            "ExtensionType": "ShoeSize",
            "ExtensionTypeFeature": "CRM",
            "Version": 1
        }
    ],
    "RelatedCustomers": [],
    "MemberOf": [],
    "Documents": [],
    "MergedCustomers": [],
    "PrimaryName": "Tester",
    "Title": "Mr.",
    "AlternateName": "Spike",
    "MiddleName": "",
    "FamilyName": "Guy",
    "Notes": "",
    "Id": "c74ad127-a206-4e69-8c69-c4800bf34b71",
    "CustomerTypeId": 2,
    "CustomerType": "Person",
    "DateOfBirth": "2015-04-20T02:43:22.79",
    "PricingGroupId": null,
    "Disabled": false,
    "DoNotContact": false,
    "Version": 1,
    "MergedIntoCustomerId": null,
    "LastModifiedDateUtc": "2018-05-29T32:16:03",
    "UniqueIdentifier": null
}

A successful request returns a 200 (OK) response code along with the complete customer record, including address, contact information, and customer extension information. For a description of parameters defined for the CustomerFull resource, see CustomerFull.

DELETE a CustomerFull Record

Deleting a CustomerFull resource disables the entire resource (that is, sets Disabled to true), including address, contact method, and so on. As when you “delete” a __Customer__resource, it does not actually delete it.

Request

DELETE /Companies({CompanyId})/CustomerFull({CustomerId})

Example Request

DELETE /Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse DeletingAFullCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse DeletingAFullCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerFull(659c2a38-d083-4421-9330-46d779702f85)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

Designate a Customer as a Child of Another Customer

Designate a customer as the child of another customer by POSTing to the parent customer’s RelatedCustomers endpoint.

Note that designating A as the child of B is the same thing as designating B the parent of A. That is, setting Sally as the child of Sampson Industries is the same thing as setting Sampson Industries as the parent of Sally. Sally will appear in Sampson Industries’ RelatedCustomers list, and Sampson Industries will appear in Sally’s MemberOf list.

Note also that a child may have many parents, and a parent may have many children. In addition, the system does not validate relationships; for example, nothing prevents a customer from being both a parent and a child of another customer. The system does prevent a customer from being designated as a parent or child of itself.

The following example designates Sally as the child of (that is, a related customer of) Sampson Industries. In this example, Sally’s and Sampson Industries’ customer identifiers are as shown below:

Customer Name Identifier
Sally 23060067-3104-438b-b486-5fcd19fcbb5d
Sampson Industries 7f2e1a71-4d9d-4269-9b7b-38dd734b84d8

Request

POST /Companies({CompanyId})/Customers({CustomerId})/RelatedCustomers

Example Request

POST /Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "23060067-3104-438b-b486-5fcd19fcbb5d"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "23060067-3104-438b-b486-5fcd19fcbb5d"
}'
static IRestResponse MakeChildCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomer");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"23060067-3104-438b-b486-5fcd19fcbb5d\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse MakeChildCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomer");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"23060067-3104-438b-b486-5fcd19fcbb5d\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"23060067-3104-438b-b486-5fcd19fcbb5d\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomer', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the parent Customer.

Request Parameters

Name Description
Id (GUID) Required. The identifier of the child customer.
ParentCustomerId (GUID) Optional. The identifier of the current customer (who is the parent of Id).

Response

Example Response

HTTP 201 Content-Type: application/json

{
    "Id": "23060067-3104-438b-b486-5fcd19fcbb5d",
    "ParentCustomerId": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8"
}

A successful request returns a 201 (Created) response code along with a RelatedCustomer object specifying the relationship between the two customers. For a description of parameters defined for the RelatedCustomer resource, see RelatedCustomer.

Retrieving the customer record for Sampson Industries shows that Sally is now a “related customer” (that is, a child customer) for Sampson Industries.

For Sampson Industries, Sally is a "related customer"

But also, retrieving Sally’s CustomerFull resource shows that Sally is now a “member of” Sampson Industries, the parent customer.

Sally is a "member of" Sampson Industries

View the Child Customers of a Customer

There are two ways to see the child records of a given customer:

You can retrieve the customer’s CustomerFull record and look at the RelatedCustomer property. (Note that you must retrieve the CustomerFull resource to get this information. RelatedCustomer information is not included in a Customer resource.) For information on retrieving a CustomerFull record, see GET a CustomerFull Record.

Alternatively, you can make a GET request to the RelatedCustomers endpoint on the Customers resource, shown here. (Note that the call must be made to the Customers resource, because the RelatedCustomers endpoint is not supported on the CustomerFull resource.)

Request

GET /Companies({CompanyId})/Customers({CustomerId})/RelatedCustomers

Example Request

GET /Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse ViewChildCustomerInformation()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse ViewChildCustomerInformation() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "ParentCustomerId": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8",
        "Id": "76cbfd57-15bc-47c0-b984-04783fdf1452"
    },
    {
        "ParentCustomerId": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8",
        "Id": "23060067-3104-438b-b486-5fcd19fcbb5d"
    }
]

A successful request returns a 200 (OK) response code along with the array listing all customers who are chilren of the current customer. For a description of parameters defined for the RelatedCustomer resource, see RelatedCustomer.

DELETE a Child Customer

Remove a customer from the list of child customers by making a DELETE request to the RelatedCustomers endpoint of the Customers resource.

Removing a child customer relationship also removes the parent relationship from the associated customer.

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})/RelatedCustomer({ChildCustomerId})

Example Request

DELETE /Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers(76cbfd57-15bc-47c0-b984-04783fdf1452)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers(76cbfd57-15bc-47c0-b984-04783fdf1452)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse DeleteChildCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers(76cbfd57-15bc-47c0-b984-04783fdf1452)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse DeleteChildCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers(76cbfd57-15bc-47c0-b984-04783fdf1452)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)/RelatedCustomers(76cbfd57-15bc-47c0-b984-04783fdf1452)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the parent customer.
ChildCustomerId (GUID) Required. The identifier of the child customer to be deleted.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

Designate a Parent Customer for a Customer

Record a parent customer by POSTing to the MemberOf endpoint of the child customer.

Note that designating A as the child of B is the same thing as designating B the parent of A. That is, setting Sampson Industries as the parent of Bert is the same thing as setting Bert as the child of Sampson Industries. Sampson Industries will appear Bert’s MemberOf list, and Bert will appear in Sampson Industries’ RelatedCustomers list.

Note also that a child may have many parents, and a parent may have many children. In addition, the system does not validate relationships; for example, nothing prevents a customer from being both a parent and a child of another customer. The system does prevent a customer from being designated as a parent or child of itself.

The following example designates Sampson Industries as the parent of Bert (that is, Bert is the child of Sampson Industries). In this example, Bert’s and Sampson Industries’ customer identifiers are as shown below:

Customer Name Identifier
Bert 76cbfd57-15bc-47c0-b984-04783fdf1452
Sampson Industries 7f2e1a71-4d9d-4269-9b7b-38dd734b84d8

Request

POST /Companies({CompanyId})/Customers({CustomerId})/MemberOf

Example Request

POST /Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json
Content-Type: application/json

{
    "Id": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8"
}
curl -X POST "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "Id": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8"
}'
static IRestResponse AddParentCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf14528)/MemberOf");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"Id\":\"7f2e1a71-4d9d-4269-9b7b-38dd734b84d8\"}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse AddParentCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"Id\":\"7f2e1a71-4d9d-4269-9b7b-38dd734b84d8\"}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"Id\":\"7f2e1a71-4d9d-4269-9b7b-38dd734b84d8\"}";

response = RestClient.post 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf', body, {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the child Customer.

Request Parameters

Name Description
Id (GUID) Required. The identifier of parent customer.
ParentCustomerId (GUID) Optional. The identifier of the current customer (who is the child of Id).

Response

Example Response

HTTP 201 Content-Type: application/json

{
    "Id": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8",
    "ChildCustomerId": "76cbfd57-15bc-47c0-b984-04783fdf1452"
}

A successful request returns a 201 (Created) response code along with a MemberOf resource specifying the relationship between Bert and Sampson Industries. For a description of parameters defined for the MemberOf resource, see MemberOf.

Retrieving Bert’s CustomerFull record shows that Bert is now a “member of” Sampson Industries; that is, Sampson Industries is now Bert’s parent customer.

Bert is a "member of" Sampson Industries

Retrieving Sampson Industries’ CustomerFull record shows that Sampson Industries now has two child customers, Sally and Bert.

Sally and Bert are both "related customers" for Sampson Industries

View the Parent Customers of a Customer

There are two ways to see the parent customers of a given customer:

You can retrieve the customer’s CustomerFull record and look at the MemberOf property. (Note that you must retrieve the CustomerFull resource to get this information. MemberOf information is not included in the Customer resource.) For information on retrieving a CustomerFull record, see GET a CustomerFull Record.

Alternatively, you can make a GET request to the MemberOf endpoint on the Customers resource, shown here. (Note that the call must be made to the Customer resource, because the MemberOf endpoint is not supported on the CustomerFull resource.)

Request

GET /Companies({CompanyId})/Customers({CustomerId})/MemberOf

Example Request

GET /Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452/MemberOf" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse ViewParentCustomerInformation()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse ViewParentCustomerInformation() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.
CustomerId (GUID) Required. The customer identifier.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json
{
    "Id": "7f2e1a71-4d9d-4269-9b7b-38dd734b84d8",
    "ChildCustomerId": "76cbfd57-15bc-47c0-b984-04783fdf1452"
}

A successful request returns a 200 (OK) response code along with the array listing all customers who are parents of the current customer. For a description of parameters defined for the MemberOf resource, see MemberOf.

DELETE a Parent Customer

Remove a customer from the list of parent customers by making a DELETE request to the MemberOf endpoint of the Customers resource.

Removing a parent customer relationship also removes the child relationship from the associated customer.

Request

DELETE /Companies({CompanyId})/Customers({CustomerId})/MemberOf({ParentCustomerId})

Example Request

DELETE /Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf1452)/MemberOf(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC

curl -X DELETE "https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf145)/MemberOf(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"
static IRestResponse DeleteParentCustomer()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf145)/MemberOf(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)");
    var request = new RestRequest(Method.DELETE);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse DeleteParentCustomer() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpDelete request = new HttpDelete("https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf145)/MemberOf(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.delete 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/Customers(76cbfd57-15bc-47c0-b984-04783fdf145)/MemberOf(7f2e1a71-4d9d-4269-9b7b-38dd734b84d8)', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
    } 

puts response

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company associated with the customer.
CustomerId (GUID) Required. The identifier of the child customer.
ParentCustomerId (GUID) Required. The identifier of the parent customer to be deleted.

Request Parameters

None.

Response

Example Response

HTTP 200 Content-Type: application/json

A successful request returns a 200 (OK) response code.

SEARCHING

There are three ways to search for customer records.

Queries are case-insensitive.

Filtering the “Customer” Resource

One way to search customer records is to use a GET request to the Customer endpoint, including filter parameters in the query string. A successful search returns a paginated list of all Customer resources matching the query string.

A query can contain multiple search filters, with the exception of UniqueIdentifier. If UniqueIdentifer is used in a query filter, it must be the only parameter. A query on UniqueIdentifier is guaranteed to return either a single result or an empty collection.

Note that although the LastModifiedDateUtc property is part of the Customer resource, querying for it is supported only on the CustomerFull endpoint.

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.

Query Parameters

GET /Companies({companyId})/Customer?$filter=PrimaryName eq 'Robert'

Filterable Properties

Filtering is supported for the following properties from the Customer resource.

Property Note
PrimaryName  
MiddleName  
FamilyName  
AlternateName  
Title  
Disabled  
UniqueIdentifier If this parameter is provided, it must be the only parameter in the query.

Query Operators

The following operators are supported in CRM API queries.

Operator Can Be Used With Example
eq Integer, String $filter=PrimaryName eq ‘Robert’

Filtering the “CustomerFull” Resource

The CustomerFull endpoint supports GET requests only for queries that include the LastModifiedDateUtc, which is a property of the Customer resource. A successful search returns a list of all Customer resources matching the query string. The list can be paginated using the supported pagination controls.

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.

Query Parameters

GET /Companies({companyId})/CustomerFull?$filter=LastModifiedDateUtc ge datetime'2017-04-06T00:00:00z'

Filterable Properties

Filtering is supported for the following properties from the CustomerFull resource.

Property Note
LastModifiedDateUtc Searches for customers modified since the specified date. You can enter a truncated value specifying just the date; if you do, the system assumes a value of 00:00:00 (midnight).

Query Operators

The following operators are supported in CRM API queries.

Operator Can Be Used With Example
ge DateTime $filter=LastModifiedDateUtc ge datetime’2017-04-06T00:00:00z’

Searching Against a Criterion

The CustomerFull resource integrates all information associated with a given customer, but does not support queries. To search for a string in CustomerFull records, make a GET request to the CustomerSearch endpoint and specify the search string as the Criteria property in the query string.

The system compares the search criterion against the fields listed in Searched Properties. If any of these fields match the search criterion, that record is considered a match and is returned as a CustomerFull resource, together with the specified Criteria string.

Path Parameters

Name Description
CompanyId (Integer) Required. The identifier of the Company.

Query Parameters

GET /Companies({companyId})/CustomerSearch?$filter=Criteria eq 'Bob'

Searched Properties

The search string specified in the Criteria parameter are compared against the fields listed below.

Resource Property
ContactMethod Value
Customer PrimaryName
Customer MiddleName
Customer FamilyName
Customer AlternateName
Customer “PrimaryName FamilyName”; for example “Bob Smith”
CustomerExtension Value

By default, embedded matches are considered; for example, a search criterion of Roy will match both Roy and Elroy.

GET /Companies({companyId})/CustomerSearch?$filter=Criteria eq 'Bob'

Requesting Optimized CustomerSearch Queries

In large deployments, searching customer records can take time. The CustomerSearch resource can support simplified queries that improve performance. The behavior of the optimized search is slightly different than that for the default search; the system will find results only where the search criterion matches the leading characters of the search fields. In the optimized search, partial matches are considered, but not embedded matches. In the optimized search, for example, a search criterion of Roy will match Roy and Royston but will NOT match Elroy.

To use the more performant, simplified search, you must explicitly “opt in” with iQmetrix. iQmetrix will set a configuration flag in your database to enable the simplified search. For more information, speak to your iQmetrix representative.

Request

GET /Companies({CompanyId})/CustomerSearch?$filter={filter}

Example Request

GET /Companies(14146)/CustomerSearch?$filter=Criteria eq 'Bob'
Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC
Accept: application/json

curl -X GET "https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerSearch?$filter=Criteria eq 'Bob'" -H "Authorization: Bearer aG1FVmhtRVZpCEVWaP51VmhsdC" -H "Accept: application/json"
static IRestResponse CustomerSearch()
{
    var client = new RestClient("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerSearch?$filter=Criteria eq 'Bob'");
    var request = new RestRequest(Method.GET);
     
    request.AddHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.AddHeader("Accept", "application/json"); 

    

    return client.Execute(request);
}

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse CustomerSearch() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet request = new HttpGet("https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerSearch?$filter=Criteria eq 'Bob'");
     
    request.addHeader("Authorization", "Bearer aG1FVmhtRVZpCEVWaP51VmhsdC"); 
    request.addHeader("Accept", "application/json"); 
    
    return httpClient.execute(request);
}
require 'rest-client'



response = RestClient.get 'https://crmdemo.iqmetrix.net/v1/Companies(14146)/CustomerSearch?$filter=Criteria eq 'Bob'', {
     :'Authorization' => 'Bearer aG1FVmhtRVZpCEVWaP51VmhsdC',
     :'Accept' => 'application/json',
    } 

puts response

Response

Example Response

HTTP 200 Content-Type: application/json
[
    {
        "Criteria": "bob",
        "Id": "503d1d4a-c974-4286-b4a2-002699e60ad6",
        "PrimaryName": "Robert",
        "MiddleName": "Lee",
        "FamilyName": "Smith",
        "Addresses": [
            {
                "Id": "a08b0640-606a-41f0-901a-facaf50e75dd",
                "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
                "AddressType": "Home",
                "AddressTypeId": 2,
                "AttentionTo": "Princess",
                "Country": "Canada",
                "CountryCode": "CA",
                "Default": false,
                "DoNotContact": true,
                "Email": "Jas@princess.ca",
                "Locality": "Mountain View",
                "Notes": "Moved as of April 15 2015",
                "Phone": "(555) 555-5555",
                "PostalCode": "94043",
                "PostOfficeBoxNumber": "P.O. Box 1022",
                "State": "Alberta",
                "StateCode": "AB",
                "StreetAddress1": "1600 Amphitheatre Pkwy",
                "StreetAddress2": "Suite 500",
                "Version": 1
            }
        ],
        "AlternateName": "Bob",
        "ContactMethods": [
            {
                "Id": "b25dd8b2-a24d-4107-8fbe-9c7b21e18137",
                "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
                "ContactMethodCategory": "Phone",
                "ContactMethodCategoryId": 1,
                "ContactMethodType": "Work",
                "ContactMethodTypeId": 2,
                "Default": true,
                "DoNotContact": true,
                "Notes": "After 6pm",
                "Value": "(306) 222-3333",
                "Version": 1
            }
        ],
        "CustomerExtensions": [
            {
                "Id": "74b87ece-5f70-454d-9991-7952127146b0",
                "CustomerId": "659c2a38-d083-4421-9330-46d779702f85",
                "ExtensionType": "ExternalCustomerId",
                "ExtensionTypeId": 2,
                "Value": "66432",
                "Version": 1
            }
        ],
        "CustomerType": "Company",
        "CustomerTypeId": 3,
        "DateOfBirth": "1952-07-23T12:00:00.000",
        "Disabled": true,
        "DoNotContact": true,
        "Notes": "Interested in iPhone 6",
        "Title": "Mr",
        "Version": 1
    }
]

A successful request returns a 200 (OK) response code along with the complete customer record, including address, contact information, and customer extension information. For a description of parameters defined for the CustomerFull resource, see CustomerFull.

PAGINATION

Pagination Controls

The Customers API supports pagination of collections for some resources.

Pagination in the Customers API is controlled by the $skip and $top query string parameters.

HAL Navigation

In addition, the CRM API supports Hypermedia Application Language (HAL) in responses. By default, HAL returns pagination links for self, prev, and next. To use this feature, you must include the Accept: application/hal+json header in the request.

Note that HAL pagination links are relative; that is, they do not include the base endpoint. It is the responsibility of the client to prepend the link appropriately, as in the following example.

{
    "_links": {
        "self": {
          "href": "Companies(14146)/Customers?$skip=10&$top=10",
          "templated": false
        },
        "next": {
          "href": "Companies(14146)/Customers?$skip=20&$top=10",
          "templated": false
        },
        "prev": {
          "href": "Companies(14146)/Customers?$skip=0&$top=10",
          "templated": false
        }
    },
    "_embedded": {
        "self": [ ]
    }
}

In this example:

ERRORS

Error Code Description Reason
HTTP 400 Bad Request The request was somehow incorrect or invalid.
HTTP 401 Unauthorized The user making the request is not authenticated. The most common reason for this is that the access token used in the request has expired. Generate a new access token (or refresh the existing token) using the Authentication API.
HTTP 403 Forbidden The user making the request is authenticated, but does not have permission to access the requested resource. Make sure that the user making the request has appropriate permissions.
HTTP 404 Not Found The requested resource cannot be found. Ensure that the request URI is correct and that the correct method has been used.
Was this page helpful?