Customer REST API

Table of contents

Searching for Customers

The following table provides the URI and method that can be used to search for customer in Crittah.

MethodResult
URIhttps://[CompanyID].crittah.com/ws/apiv2/[json or xml]/customers/search
POST

Post a JSON or XML object with search criteria.

Search Fields

FieldValue typeMandatoryDescriptionExample
CompanyNamestring


Company name of customer. Partial matches will return results.Megga Corp
CompanyNostring
Company number of customer. Partial matches will return results.ABN65482555
Phonestring
Phone number of the contact. Partial matches will return results.987649874
Mobilestring


Mobile phone number of the contact. Partial matches will return results.041658246
Faxstring
Fax number of the contact. Partial matches will return results.6546548665
Citystring


City of the contact. Partial matches will return results.Sydney
CustomerRefstring
The unique reference of the customer allocated by Crittah customer is created6548335
PostalCodestring
Post code of the customer. Partial matches will return results.

Example Search

Perform a POST to the following URL https://[companyID].crittah.com/ws/apiv2/json/customers/search

JSON

{
	"CompanyName": "Super Corp"
}

XML

<?xml version="1.0" encoding="UTF-8"?>
<CustomeSearchParamsComplex xmlns="http://schemas.datacontract.org/2004/07/Spinifex.lib.objects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<CompanyName>Super Corp</CompanyName>
</CustomeSearchParamsComplex>


Working with a single customer

MethodResult
URIhttps://[CompanyID].crittah.com/ws/apiv2/[json or xml]/customers/[customerId]
DELETEDeletes one customer
GETReturns data for one customer
POSTCreate or modify only the supplied data for one customer; returns customer data after request
PUTNot supported

Data fields

FieldValue typeMandatoryDescriptionExample
IDCustomerstring
Unique identifier of the customer. The CustomerID is used for updating or deleting an existing customer.7090fad1-c4da-4488-9ceb-55ee9847edcc
CustomerRefstring
Human readable unique identifier of the customer2586681
ExternalRefstring
A reference to an id used in an external system to Crittah. This can be used to link Crittah to internal systems and maintaining the relationship between the two systems.HSG29373
IDSitestring
Unique ID for the site the customer belongs to20058233-7388-418b-9193-6b57e28604f9
Sitestring
Site Name that customer belongs toSYD
TypesTypes Object
Array of types returned when getting a record

[ { "IDType": "c0fd94f3-2ddd-4eea-bc24-40189480d10f",

"Type": "Producer" },
{ "IDType": "eb6bef8f-6f03-49dd-80a4-83a220f6ddc3",
"Type": "VIP" } ]

IDTypesArray strings
Used when adding or updating the record"IDTypes": [ "c0fd94f3-2ddd-4eea-bc24-40189480d10f", "eb6bef8f-6f03-49dd-80a4-83a220f6ddc3"]
IDStatusstring
IDStatus of customer926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa
Statusstring
Indicates the status of the customer.Pending
IDParentstring
ID of the parent customer. This is used when linking many customer to a single head office customer.926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa
CompanyNamestring
Name of the customer.Megga Corp Pty Ltd
CompanyNostring
Legal registered company number28787 876 8876
Phonestring
Customers phone(02) 9506 3560
Mobilestring
Customers Mobile0412 544 654
Faxstring
Customers Fax(02) 9567 680
Councilstring
Local council customer resides in.Parramatta
WebSitestring
customers positionManager
AddressBillingAddress Object
Customers Billing AddressSee Address Object
AddressAddress Object
Customers Physical AddressSee Address Object
NotesArray of Notes Object
Customers notes.See Notes Object
AccountOwnerstring
Account owner that the customer belongs to. This is a user in Crittah. User list information can be retrieved users from the Helper REST API926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa

Examples

Get a customers details

Sample cURL call:

curl -H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://[companyID].crittah.com/ws/apiv2/json/customers/5f3f2135-d0f5-47a4-906e-7274b0128054

JSON Rsponse:

 {
  "IDCustomer": "5f3f2135-d0f5-47a4-906e-7274b0128054",
  "IDSite": "20058233-7388-418b-9193-6b57e28604f9",
  "Site": "SYD",
  "Types": [
    {
      "IDType": "4d819963-731c-41fd-9378-fd7a10199b78",
      "Type": "Associates"
    },
    {
      "IDType": "21a952eb-089e-467a-98bf-f8cb9a0ebd88",
      "Type": "Producer"
    }
  ],
  "IDStatus": "926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa",
  "Status": "Active",
  "Parent": null,
  "CompanyName": "Sydney Bunting Supplies",
  "CompanyNo": "654 654 9879",
  "CustomerRef": "7193032",
  "Phone": "9575 545",
  "Mobile": "0414 656 654",
  "Fax": "654 654 544",
  "Council": "Sydney",
  "WebSite": "http:\/\/www.buntingsupplies.comau",
  "AddressBilling": {
    "IDAddress": "368321fe-de7e-4f38-80a7-e7ea8e34fe26",
    "AddressLine1": "88 Castlereagh Street",
    "AddressLine2": null,
    "City": "SYDNEY",
    "State": "NSW",
    "IDCountry": 1013,
    "Country": "Australia",
    "PostCode": "2000",
    "LocRef": {
      "IDLocation": "6db14940-f906-4c20-949a-e332f6798336",
      "LatLng": {
        "Lat": -33.869738,
        "Lng": 151.209448
      }
    }
  },
  "Address": {
    "IDAddress": "2d69c03b-5b57-46b4-8d67-43d2f27d225a",
    "AddressLine1": "88 Castlereagh Street",
    "AddressLine2": null,
    "City": "SYDNEY",
    "State": "NSW",
    "IDCountry": 1013,
    "Country": "Australia",
    "PostCode": "2000",
    "LocRef": {
      "IDLocation": "e97c85a5-62c0-4e13-bb63-ed8a43050360",
      "LatLng": {
        "Lat": -33.869738,
        "Lng": 151.209448
      }
    }
  },
  "AccountOwner": "00000000-0000-0000-0000-000000000000",
  "Notes": [
    {
      "IDNote": "05629a9b-2869-4197-82af-b6f975be93c8",
      "IDEntity": "5f3f2135-d0f5-47a4-906e-7274b0128054",
      "IDNoteType": "77d5d244-eb29-4b5b-8b14-87d92b4215ea",
      "Type": "General",
      "NoteInfo": "Contact the front desk for assistance"
    },
    {
      "IDNote": "cf67b514-3ba2-44d9-82f0-c0d5f8d57816",
      "IDEntity": "5f3f2135-d0f5-47a4-906e-7274b0128054",
      "IDNoteType": "77d5d244-eb29-4b5b-8b14-87d92b4215ea",
      "Type": "General",
      "NoteInfo": "Entry is via 120 King st - last driveway on right before Castlereagh st."
    }
  ]
}

XML Response: 

 <?xml version="1.0" encoding="UTF-8"?>
<CustomerObj xmlns="http://schemas.datacontract.org/2004/07/Spinifex.lib.objects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <IDCustomer>5f3f2135-d0f5-47a4-906e-7274b0128054</IDCustomer>
   <IDSite>20058233-7388-418b-9193-6b57e28604f9</IDSite>
   <Site>SYD</Site>
   <Types>
      <TypeObj>
         <IDType>4d819963-731c-41fd-9378-fd7a10199b78</IDType>
         <Type>Associates</Type>
      </TypeObj>
      <TypeObj>
         <IDType>21a952eb-089e-467a-98bf-f8cb9a0ebd88</IDType>
         <Type>Producer</Type>
      </TypeObj>
   </Types>
   <IDStatus>926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa</IDStatus>
   <Status>Active</Status>
   <Parent i:nil="true" />
   <CompanyName>Sydney Bunting Supplies</CompanyName>
   <CompanyNo>654 654 9879</CompanyNo>
   <CustomerRef>7193032</CustomerRef>
   <Phone>9575545</Phone>
   <Mobile>0414 656 654</Mobile>
   <Fax>654 654 544</Fax>
   <Council>Sydney</Council>
   <WebSite>http://www.buntingsupplies.comau</WebSite>
   <AddressBilling>
      <IDAddress>368321fe-de7e-4f38-80a7-e7ea8e34fe26</IDAddress>
      <AddressLine1>88 Castlereagh Street</AddressLine1>
      <AddressLine2 i:nil="true" />
      <City>SYDNEY</City>
      <State>NSW</State>
      <IDCountry>1013</IDCountry>
      <Country>Australia</Country>
      <PostCode>2000</PostCode>
      <LocRef>
         <IDLocation>6db14940-f906-4c20-949a-e332f6798336</IDLocation>
         <LatLng>
            <Lat>-33.869738</Lat>
            <Lng>151.209448</Lng>
         </LatLng>
      </LocRef>
   </AddressBilling>
   <Address>
      <IDAddress>2d69c03b-5b57-46b4-8d67-43d2f27d225a</IDAddress>
      <AddressLine1>88 Castlereagh Street</AddressLine1>
      <AddressLine2 i:nil="true" />
      <City>SYDNEY</City>
      <State>NSW</State>
      <IDCountry>1013</IDCountry>
      <Country>Australia</Country>
      <PostCode>2000</PostCode>
      <LocRef>
         <IDLocation>e97c85a5-62c0-4e13-bb63-ed8a43050360</IDLocation>
         <LatLng>
            <Lat>-33.869738</Lat>
            <Lng>151.209448</Lng>
         </LatLng>
      </LocRef>
   </Address>
   <AccountOwner>00000000-0000-0000-0000-000000000000</AccountOwner>
   <Notes>
      <NoteObj>
         <IDNote>05629a9b-2869-4197-82af-b6f975be93c8</IDNote>
         <IDEntity>5f3f2135-d0f5-47a4-906e-7274b0128054</IDEntity>
         <IDNoteType>77d5d244-eb29-4b5b-8b14-87d92b4215ea</IDNoteType>
         <Type>General</Type>
         <NoteInfo>Contact the front desk for assistance</NoteInfo>
      </NoteObj>
      <NoteObj>
         <IDNote>cf67b514-3ba2-44d9-82f0-c0d5f8d57816</IDNote>
         <IDEntity>5f3f2135-d0f5-47a4-906e-7274b0128054</IDEntity>
         <IDNoteType>77d5d244-eb29-4b5b-8b14-87d92b4215ea</IDNoteType>
         <Type>General</Type>
         <NoteInfo>Entry is via 120 King st - last driveway on right before Castlereagh st.</NoteInfo>
      </NoteObj>
   </Notes>
</CustomerObj>

Add Customer

Add the following contents to a file called "add_customer.data"

{
  "CompanyName": "Test Incorperated",
  "CompanyNo": "987 654 3210",
  "Phone": "555 3293 2001",
  "Mobile": "0416 234 568",
  "Fax": "555 323 574",
  "Council": "LA",
  "IDSite": "20058233-7388-418b-9193-6b57e28604f9",
  "IDTypes": [
    "4d819963-731c-41fd-9378-fd7a10199b78",
    "21a952eb-089e-467a-98bf-f8cb9a0ebd88"
  ],
  "IDStatus": "926a4185-6cb3-4a2a-a8ec-1fadc1cf4caa",
  "WebSite": "http:\/\/www.testcorp.com",
  "Address": {
    "AddressLine1": "Suite 8032",
    "AddressLine2": "21 King Street",
    "City": "SYDNEY",
    "State": "NSW",
    "Country": "Australia",
    "PostCode": "2021",
    "LocRef": {
      "LatLng": {
        "Lat": -33.869738,
        "Lng": 151.209448
      }
    }
  },
  "AddressBilling": {
    "AddressLine1": "Suite 8032",
    "AddressLine2": "22 King Street",
    "City": "SYDNEY",
    "State": "NSW",
    "Country": "Australia",
    "PostCode": "2022"
  },
  "Notes": [
    {
      "IDNoteType": "77d5d244-eb29-4b5b-8b14-87d92b4215ea",
      "NoteInfo": "Take lift to level 8 turn right. Reception in front of you."
    },
    {
      "IDNoteType": "77d5d244-eb29-4b5b-8b14-87d92b4215ea",
      "NoteInfo": "If receptionist not there ring bell on wall."
    }
  ]
}

Run the follow cURL command

curl -X POST -d add_customer.data  \
-H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/json/customers

Update customer

Add the following contents to a file calls "update_customer.data"

{
  "CompanyName": "North Bunting Supplies",
  "CompanyNo": "111 222 3333",
  "IDTypes": [ "eb6bef8f-6f03-49dd-80a4-83a220f6ddc3"],
  "Fax": "654 654 124",
  "WebSite": "http:\/\/www.buntingsupplies.com.au",
  "AddressBilling": {
    "AddressLine1": "99 Castlereagh Street",
    "AddressLine2": null,
    "City": "NORTH SYDNEY",
    "PostCode": "2001"
   },
  "Address": {
    "AddressLine1": "91 Castlereagh Street",
    "AddressLine2": null,
    "City": "NORTH SYDNEY"
  }
}

Run the follow cURL command

curl -X POST -d update_customer.data  \
-H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/json/customers/[idcontact to update]


Delete a customer

curl  -X DELETE \
-H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/json/customers/fde3e1d7-5a7c-493d-b49f-dd514fa3b3af