Difference between revisions of "CRM-2 Contacts API"

From Opentaps Wiki
Jump to navigationJump to search
m (Protected "CRM-2 Contacts API": Sysop page [edit=sysop:move=sysop])
Line 3: Line 3:
 
The API calls follow the general RESTful pattern of [[CRM-2 API]].
 
The API calls follow the general RESTful pattern of [[CRM-2 API]].
  
The base URL is <tt>http://crm-2-url/crm2/contact</tt> , only POST is currently supported, which is used to create or update a contact.
+
The base URL is <tt>http://crm-2-url/crm2/contact</tt>
  
 +
GET: Get a List of Contacts by:
 +
* contactId
 +
* emailAddress
 +
* attribute Map
 +
 +
POST: Create or update Contact
  
 
The following parameters are supported:
 
The following parameters are supported:
Line 13: Line 19:
 
** emailN (the email address)
 
** emailN (the email address)
 
** emailPurposeN (can be one of : PRIMARY, OTHER, ORDER, BILLING_AR, PAYMENT_AR, SHIPMENT)
 
** emailPurposeN (can be one of : PRIMARY, OTHER, ORDER, BILLING_AR, PAYMENT_AR, SHIPMENT)
* attribute_XXX (can define additional attributes where XXX is the attribute name)
+
* attribute Map
 
 
  
 
Only the attributes given as attribute_XXX are used to find an existing contact for update, if they are not given and / or a contact matching those is not found the operation will create a new contact.
 
Only the attributes given as attribute_XXX are used to find an existing contact for update, if they are not given and / or a contact matching those is not found the operation will create a new contact.
Line 20: Line 25:
 
The operation returns a JSON response with the contact ID of the created or updated record, eg:
 
The operation returns a JSON response with the contact ID of the created or updated record, eg:
 
   { "contact": { "contactId": XXX } }
 
   { "contact": { "contactId": XXX } }
 +
 +
The attribute Map is described as a series of <tt>attribute_${key}=${value}</tt> parameters.  For example, attribute_opentapsPartyId=12345 will become {opentapsPartyId:12345}

Revision as of 18:33, 5 April 2013

Contacts API is used to create and retreive contacts.

The API calls follow the general RESTful pattern of CRM-2 API.

The base URL is http://crm-2-url/crm2/contact

GET: Get a List of Contacts by:

  • contactId
  • emailAddress
  • attribute Map

POST: Create or update Contact

The following parameters are supported:

  • firstName
  • lastName
  • companyName
  • emailsNumber (used to iterate the following parameter where N is an index number)
    • emailN (the email address)
    • emailPurposeN (can be one of : PRIMARY, OTHER, ORDER, BILLING_AR, PAYMENT_AR, SHIPMENT)
  • attribute Map

Only the attributes given as attribute_XXX are used to find an existing contact for update, if they are not given and / or a contact matching those is not found the operation will create a new contact.

The operation returns a JSON response with the contact ID of the created or updated record, eg:

 { "contact": { "contactId": XXX } }

The attribute Map is described as a series of attribute_${key}=${value} parameters. For example, attribute_opentapsPartyId=12345 will become {opentapsPartyId:12345}