Skip to content

automateCRM REST API

Nilay Khatri edited this page Nov 12, 2024 · 3 revisions

automateCRM REST API operations

Endpoint

The endpoint for REST API is

<your crm url>/webservice.php

Authentication

Login/Authentication process, for which the following parameters are required:

  1. url
  2. Username
  3. Access Key

URL would be your Webservice end point. User Name would be the User's username with which you want to login. Access key for the user can be obtained from CRM Settings > Users and Role Management > Users under User Advanced options

While using the client libraries, doLogin operation should be called with the username and access key as the parameters.

To get the sessionName:

  1. Perform the getchallenge operation. Which will return a service token.
  2. Generate a MD5 hash of service token + user access key.
  3. Perform the login operation with the accessKey value being the MD5 hash generated in previous step.

On successfull login, you will recieve the sessionName along with the various preferences of the user.

Operations

Describe

This operation provides Metadata of a given module such as record-permissions, blocks, field configuration etc..

GET endpoint/describe?elementType=moduleName

While using client libraries use the doDescribe operation with the module name as parameter.

Response

A sample response would look like:

Array
(
    [label] => Contacts
    [name] => Contacts
    [createable] => 1
    [updateable] => 1
    [deleteable] => 1
    [retrieveable] => 1
    [fields] => Array
        (
            [0] => Array
                (
                    [name] => salutationtype
                    [label] => Salutation
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [1] => Array
                (
                    [name] => firstname
                    [label] => First Name
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [2] => Array
                (
                    [name] => contact_no
                    [label] => Contact Id
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 
                    [default] => 
                )

            [3] => Array
                (
                    [name] => phone
                    [label] => Office Phone
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [4] => Array
                (
                    [name] => lastname
                    [label] => Last Name
                    [mandatory] => 1
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 1
                    [default] => 
                )

            [5] => Array
                (
                    [name] => mobile
                    [label] => Mobile Phone
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [6] => Array
                (
                    [name] => account_id
                    [label] => Organization Name
                    [mandatory] => 
                    [type] => Array
                        (
                            [refersTo] => Array
                                (
                                    [0] => Accounts
                                )

                            [name] => reference
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [7] => Array
                (
                    [name] => homephone
                    [label] => Home Phone
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [8] => Array
                (
                    [name] => leadsource
                    [label] => Lead Source
                    [mandatory] => 
                    [type] => Array
                        (
                            [picklistValues] => Array
                                (
                                    [0] => Array
                                        (
                                            [label] => Cold Call
                                            [value] => Cold Call
                                        )

                                    [1] => Array
                                        (
                                            [label] => Existing Customer
                                            [value] => Existing Customer
                                        )

                                    [2] => Array
                                        (
                                            [label] => Self Generated
                                            [value] => Self Generated
                                        )

                                    [3] => Array
                                        (
                                            [label] => Employee
                                            [value] => Employee
                                        )

                                    [4] => Array
                                        (
                                            [label] => Partner
                                            [value] => Partner
                                        )

                                    [5] => Array
                                        (
                                            [label] => Public Relations
                                            [value] => Public Relations
                                        )

                                    [6] => Array
                                        (
                                            [label] => Direct Mail
                                            [value] => Direct Mail
                                        )

                                    [7] => Array
                                        (
                                            [label] => Conference
                                            [value] => Conference
                                        )

                                    [8] => Array
                                        (
                                            [label] => Trade Show
                                            [value] => Trade Show
                                        )

                                    [9] => Array
                                        (
                                            [label] => Web Site
                                            [value] => Web Site
                                        )

                                    [10] => Array
                                        (
                                            [label] => Word of mouth
                                            [value] => Word of mouth
                                        )

                                    [11] => Array
                                        (
                                            [label] => Other
                                            [value] => Other
                                        )

                                )

                            [defaultValue] => Cold Call
                            [name] => picklist
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [9] => Array
                (
                    [name] => otherphone
                    [label] => Secondary Phone
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [10] => Array
                (
                    [name] => title
                    [label] => Title
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [11] => Array
                (
                    [name] => fax
                    [label] => Fax
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [12] => Array
                (
                    [name] => department
                    [label] => Department
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [13] => Array
                (
                    [name] => birthday
                    [label] => Date of Birth
                    [mandatory] => 
                    [type] => Array
                        (
                            [format] => mm-dd-yyyy
                            [name] => date
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [14] => Array
                (
                    [name] => email
                    [label] => Primary Email
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => email
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [15] => Array
                (
                    [name] => contact_id
                    [label] => Reports To
                    [mandatory] => 
                    [type] => Array
                        (
                            [refersTo] => Array
                                (
                                    [0] => Contacts
                                )

                            [name] => reference
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [16] => Array
                (
                    [name] => assistant
                    [label] => Assistant
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [17] => Array
                (
                    [name] => secondaryemail
                    [label] => Secondary Email
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => email
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [18] => Array
                (
                    [name] => assistantphone
                    [label] => Assistant Phone
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [19] => Array
                (
                    [name] => donotcall
                    [label] => Do Not Call
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [20] => Array
                (
                    [name] => emailoptout
                    [label] => Email Opt Out
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [21] => Array
                (
                    [name] => assigned_user_id
                    [label] => Assigned To
                    [mandatory] => 1
                    [type] => Array
                        (
                            [name] => owner
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 1
                    [default] => 
                )

            [22] => Array
                (
                    [name] => reference
                    [label] => Reference
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [23] => Array
                (
                    [name] => notify_owner
                    [label] => Notify Owner
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [24] => Array
                (
                    [name] => createdtime
                    [label] => Created Time
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => datetime
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 
                    [default] => 
                )

            [25] => Array
                (
                    [name] => modifiedtime
                    [label] => Modified Time
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => datetime
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 
                    [default] => 
                )

            [26] => Array
                (
                    [name] => modifiedby
                    [label] => Last Modified By
                    [mandatory] => 
                    [type] => Array
                        (
                            [refersTo] => Array
                                (
                                    [0] => Users
                                )

                            [name] => reference
                        )

                    [isunique] => 
                    [nullable] => 
                    [editable] => 1
                    [default] => 
                )

            [27] => Array
                (
                    [name] => portal
                    [label] => Portal User
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [28] => Array
                (
                    [name] => support_start_date
                    [label] => Support Start Date
                    [mandatory] => 
                    [type] => Array
                        (
                            [format] => mm-dd-yyyy
                            [name] => date
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [29] => Array
                (
                    [name] => support_end_date
                    [label] => Support End Date
                    [mandatory] => 
                    [type] => Array
                        (
                            [format] => mm-dd-yyyy
                            [name] => date
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [30] => Array
                (
                    [name] => mailingstreet
                    [label] => Mailing Street
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => text
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [31] => Array
                (
                    [name] => otherstreet
                    [label] => Other Street
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => text
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [32] => Array
                (
                    [name] => mailingcity
                    [label] => Mailing City
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [33] => Array
                (
                    [name] => othercity
                    [label] => Other City
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [34] => Array
                (
                    [name] => mailingstate
                    [label] => Mailing State
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [35] => Array
                (
                    [name] => otherstate
                    [label] => Other State
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [36] => Array
                (
                    [name] => mailingzip
                    [label] => Mailing Zip
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [37] => Array
                (
                    [name] => otherzip
                    [label] => Other Zip
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [38] => Array
                (
                    [name] => mailingcountry
                    [label] => Mailing Country
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [39] => Array
                (
                    [name] => othercountry
                    [label] => Other Country
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [40] => Array
                (
                    [name] => mailingpobox
                    [label] => Mailing P.O. Box
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [41] => Array
                (
                    [name] => otherpobox
                    [label] => Other P.O. Box
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [42] => Array
                (
                    [name] => imagename
                    [label] => Contact Image
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [43] => Array
                (
                    [name] => description
                    [label] => Description
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => text
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [44] => Array
                (
                    [name] => isconvertedfromlead
                    [label] => Is Converted From Lead
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => no
                )

            [45] => Array
                (
                    [name] => source
                    [label] => Source
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 
                    [default] => 
                )

            [46] => Array
                (
                    [name] => starred
                    [label] => starred
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => boolean
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [47] => Array
                (
                    [name] => tags
                    [label] => tags
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => string
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [48] => Array
                (
                    [name] => cf_852
                    [label] => SECOND pHONE
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => phone
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [49] => Array
                (
                    [name] => cf_854
                    [label] => Decimal 10 1
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => double
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [50] => Array
                (
                    [name] => cf_856
                    [label] => Integer 3
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => integer
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [51] => Array
                (
                    [name] => cf_858
                    [label] => Percentage
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => double
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [52] => Array
                (
                    [name] => cf_860
                    [label] => Currency 2
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => currency
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [53] => Array
                (
                    [name] => cf_862
                    [label] => Date Field
                    [mandatory] => 
                    [type] => Array
                        (
                            [format] => mm-dd-yyyy
                            [name] => date
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [54] => Array
                (
                    [name] => cf_864
                    [label] => URL
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => url
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [55] => Array
                (
                    [name] => cf_866
                    [label] => Multi Picklist
                    [mandatory] => 
                    [type] => Array
                        (
                            [picklistValues] => Array
                                (
                                    [0] => Array
                                        (
                                            [label] => 1
                                            [value] => 1
                                        )

                                    [1] => Array
                                        (
                                            [label] => 2
                                            [value] => 2
                                        )

                                    [2] => Array
                                        (
                                            [label] => 3
                                            [value] => 3
                                        )

                                    [3] => Array
                                        (
                                            [label] => 4
                                            [value] => 4
                                        )

                                    [4] => Array
                                        (
                                            [label] => 5
                                            [value] => 5
                                        )

                                    [5] => Array
                                        (
                                            [label] => 6
                                            [value] => 6
                                        )

                                )

                            [defaultValue] => 1
                            [name] => multipicklist
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [56] => Array
                (
                    [name] => cf_868
                    [label] => Skype
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => skype
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [57] => Array
                (
                    [name] => cf_870
                    [label] => Time
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => time
                        )

                    [isunique] => 
                    [nullable] => 1
                    [editable] => 1
                    [default] => 
                )

            [58] => Array
                (
                    [name] => id
                    [label] => contactid
                    [mandatory] => 
                    [type] => Array
                        (
                            [name] => autogenerated
                        )

                    [editable] => 
                    [nullable] => 
                    [default] => 
                )

        )

    [idPrefix] => 12
    [isEntity] => 1
    [allowDuplicates] => 1
    [labelFields] => firstname,lastname
)

A generalized data structure for the response would be:

Array
(
    [label] => <Translated Module Name>
    [name] => <Internal Module Name>
    [createable] => <permission of the logged in user to create records in this module>
    [updateable] => <permission of the logged in user to edit records in this module>
    [deleteable] => <permission of the logged in user to delete records in this module>
    [retrieveable] => <permission of the logged in user to read records from this module>
    [fields] => Array <Array of all the fields with respective attributes>
    [idPrefix] => <ID of the module, which is used to build the Webservice format (idPrefix X Record ID, e.g 12x3) ID for a record>
    [isEntity] => <Idicates whether this module is of Type Entity or Extension>
    [allowDuplicates] => <Does this module allows to create duplicate records>
    [labelFields] => <Record identifer fields for this Module>
)

The Fields subarray would contain an array for each field. The Field array might contain some specific attributes based on the UIType. In general, the field subarray has the following structure:

Array(
	[name] => <internal fieldname>
	[label] => <Translated Field Label>
	[mandatory] => <is the field mandatory or not>
	[type] => Array
		(
			[name] => <type of the field e.g. string, picklist, referemce, owner etc.>
		)

	[isunique] => 
	[nullable] => <can accept null values?>
	[editable] => <permission of the logged in user to edit this field>
	[default] => <default value for this field>
)

Structure for Picklist field:

Array(
                    [name] => <internal fieldname>
                    [label] => <Translated Field Label>
                    [mandatory] => <is the field mandatory or not>
                    [type] => Array
                        (
                            [picklistValues] => Array
                                (
                                    [0] => Array
                                        (
                                            [label] => <Translated label for the value>
                                            [value] => <Actual value>
                                        )

                                    [1] => Array
                                        (
                                            [label] => Existing Customer
                                            [value] => Existing Customer
                                        )

                                    [2] => Array
                                        (
                                            [label] => Self Generated
                                            [value] => Self Generated
                                        )

                                    [3] => Array
                                        (
                                            [label] => Employee
                                            [value] => Employee
                                        )

                                )

                            [defaultValue] => <default selected value for this field>
                            [name] => picklist
                        )

                    [isunique] => 
                    [nullable] => <can accept null values?>
                    [editable] => <permission of the logged in user to edit this field>
                    [default] => <default value for this field>
                )

Similarly, for Date field, the specific attributes are:

Array(
	[format] => <user's preferred date format>
	[name] => date
)

Note: while creating records, date format to be used is yyyy-mm-dd

Reference Field:

Array(
	[refersTo] => Array     
		(
			[0] => Contacts
			[1] => Accounts
			[2] => ...
		)

	[name] => reference
)

"refersTo" is a sub-array which contains list of all the modules that this field refers to.

Owner field:

Array(
	[name] => owner
)

Note: owner field acts like picklist field, but the values are the list of Users and Groups

ListTypes

This operation will provide you list of all the Modules to which the authenticated user has access to.

GET endpoint/listtypes

While using client libraries use the doList operation.

Create

this operation is used to create records into the CRM.

POST endpoint/create

elementType=moduleName element=convert_into_json_string ({field1: value1, field2=value2})

While using the client libraries use the doCreate operation with the module name and the JSON encoded field name => field value map.

Retrieve

This operation is used to fetch a particular record by its id.

GET endpoint/retrieve?id=record_id

While using the client libraries use the doRetrieve operation with the record ID as parameter.

Response

A sample response looks like:

Array
(
    [salutationtype] => 
    [firstname] => Karthik
    [contact_no] => CON1
    [phone] => 9922992288
    [lastname] => Srinivasa
    [mobile] => 9922992288
    [account_id] => 
    [homephone] => 9922992288
    [leadsource] => 
    [otherphone] => 9922992288
    [title] => 
    [fax] => 
    [department] => 
    [birthday] => 2019-05-01
    [email] => 
    [contact_id] => 
    [assistant] => 
    [secondaryemail] => 
    [assistantphone] => 
    [donotcall] => 0
    [emailoptout] => 0
    [assigned_user_id] => 19x1
    [reference] => 0
    [notify_owner] => 0
    [createdtime] => 2019-05-03 16:46:03
    [modifiedtime] => 2019-05-03 16:46:03
    [modifiedby] => 19x1
    [portal] => 0
    [support_start_date] => 2019-05-03
    [support_end_date] => 2020-05-03
    [mailingstreet] => 
    [otherstreet] => 
    [mailingcity] => 
    [othercity] => 
    [mailingstate] => 
    [otherstate] => 
    [mailingzip] => 
    [otherzip] => 
    [mailingcountry] => 
    [othercountry] => 
    [mailingpobox] => 
    [otherpobox] => 
    [imagename] => 
    [description] => Test
    [isconvertedfromlead] => 0
    [source] => CRM
    [starred] => 0
    [tags] => 
    [cf_852] => 
    [cf_854] => 
    [cf_856] => 
    [cf_858] => 
    [cf_860] => 
    [cf_862] => 
    [cf_864] => 
    [cf_866] => 
    [cf_868] => 
    [cf_870] => 
    [id] => 12x2
    [label] => Karthik Srinivasa
)

A generalized data structure would be:

Array(
      <fieldname>  => <value>,
      <id>  =>  <webservice format record ID>,
      <label>  => <label/indentifier value for this record>
)

Update

This operation is used to update the values of a particular Record. Note: it is required that all the Mandatory fields are included in the request, if a Mandatory field is not included the API call would throw an exception. And the values of the fields which were not included remain as it is.

POST endpoint/update

element=convert_into_json_string({id:record_id, field1:revalue1, field2:value2})

While using the client libraries use the doUpdate operation with the JSON encoded field name => field value map, it must contain "id" of the record as a key value pair.

Sample Request:

Array(
            'salutationtype' => 'Mr.', 
            'firstname' => 'Test',
            'phone' => '',
            'lastname' => '001',
            'mobile' => '',
            'account_id' => '', 
            'homephone' => '',
            'leadsource' => '',
            'otherphone' => '',
            'title' => '',
            'fax' => '',
            'department' => '', 
            'birthday' => '',
            'email' => '',
            'contact_id' => '', 
            'assistant' => '',
            'secondaryemail' => '', 
            'assistantphone' => '',
            'donotcall' => 0,
            'emailoptout' => 0,
            'assigned_user_id' => '19x1',
            'reference' => 0,
            'notify_owner' => 0,
            'portal' => 0,
            'support_start_date' => '', 
            'support_end_date' => '',
            'mailingstreet' => '',
            'otherstreet' => '',
            'mailingcity' => '',
            'othercity' => '',
            'mailingstate' => '',
            'otherstate' => '',
            'mailingzip' => '',
            'otherzip' => '',
            'mailingcountry' => '', 
            'othercountry' => '',
            'mailingpobox' => '',
            'otherpobox' => '',
            'imagename' => '',
            'description' => '',
            'cf_852' => '',
            'cf_854' => '',
            'cf_856' => '',
            'cf_858' => '',
            'cf_860' => '',
            'cf_862' => '',
            'cf_864' => '',
            'cf_866' => '',
            'cf_868' => '',
            'cf_870' => '',
            'cf_872' => '00:00',
            'id' => '12x16'
        );

Response: response would be the updated record,

Array
(
    [salutationtype] => Mr.
    [firstname] => Test
    [contact_no] => CON15
    [phone] => 
    [lastname] => 001
    [mobile] => 
    [account_id] => 
    [homephone] => 
    [leadsource] => 
    [otherphone] => 
    [title] => 
    [fax] => 
    [department] => 
    [birthday] => 
    [email] => 
    [contact_id] => 
    [assistant] => 
    [secondaryemail] => 
    [assistantphone] => 
    [donotcall] => 0
    [emailoptout] => 0
    [assigned_user_id] => 19x1
    [reference] => 0
    [notify_owner] => 0
    [createdtime] => 2019-05-05 19:20:48
    [modifiedtime] => 2019-08-05 14:13:31
    [modifiedby] => 19x1
    [portal] => 0
    [support_start_date] => 
    [support_end_date] => 
    [mailingstreet] => 
    [otherstreet] => 
    [mailingcity] => 
    [othercity] => 
    [mailingstate] => 
    [otherstate] => 
    [mailingzip] => 
    [otherzip] => 
    [mailingcountry] => 
    [othercountry] => 
    [mailingpobox] => 
    [otherpobox] => 
    [imagename] => 
    [description] => 
    [isconvertedfromlead] => 0
    [source] => WEBSERVICE
    [starred] => 0
    [tags] => 
    [cf_852] => 
    [cf_854] => 
    [cf_856] => 
    [cf_858] => 
    [cf_860] => 
    [cf_862] => 
    [cf_864] => 
    [cf_866] => 
    [cf_868] => 
    [cf_870] => 
    [cf_872] => 00:00
    [id] => 12x16
)

Note: Below is a sample request where we are not passing value of the 'firstname' and a custom mandatory field 'cf_872'. The API call throws an exception and the value of firstname remains as it is:

Request data:

Array(
            'salutationtype' => 'Mr.', 
            'phone' => '',
            'lastname' => '001',
            'mobile' => '',
            'account_id' => '', 
            'homephone' => '',
            'leadsource' => '',
            'otherphone' => '',
            'title' => '',
            'fax' => '',
            'department' => '', 
            'birthday' => '',
            'email' => '',
            'contact_id' => '', 
            'assistant' => '',
            'secondaryemail' => '', 
            'assistantphone' => '',
            'donotcall' => 0,
            'emailoptout' => 0,
            'assigned_user_id' => '19x1',
            'reference' => 0,
            'notify_owner' => 0,
            'portal' => 0,
            'support_start_date' => '', 
            'support_end_date' => '',
            'mailingstreet' => '',
            'otherstreet' => '',
            'mailingcity' => '',
            'othercity' => '',
            'mailingstate' => '',
            'otherstate' => '',
            'mailingzip' => '',
            'otherzip' => '',
            'mailingcountry' => '', 
            'othercountry' => '',
            'mailingpobox' => '',
            'otherpobox' => '',
            'imagename' => '',
            'description' => '',
            'cf_852' => '',
            'cf_854' => '',
            'cf_856' => '',
            'cf_858' => '',
            'cf_860' => '',
            'cf_862' => '',
            'cf_864' => '',
            'cf_866' => '',
            'cf_868' => '',
            'cf_870' => '',
            'id' => '12x16'
        );

Response:

(
    [code] => MANDATORY_FIELDS_MISSING
    [message] => cf_872 does not have a value
)

Revise

Revise operation is similar to the update operations but with two differences:

  1. You can send only the fields which you want to update
  2. If any mandatory field is missing in the request its value would be picked up by the CRM

POST endpoint/revise

element=convert_into_json_string({id:record_id, field1:revalue1, field2:value2})

Request:

Array(
            'firstname' => 'Test First Name',
            'mobile' => '1111111',
			'id' => '12x16'
		);

Response:

Array
(
    [salutationtype] => Mr.
    [firstname] => Test First Name
    [contact_no] => CON15
    [phone] => 
    [lastname] => 001
    [mobile] => 1111111
    [account_id] => 
    [homephone] => 
    [leadsource] => 
    [otherphone] => 
    [title] => 
    [fax] => 
    [department] => 
    [birthday] => 
    [email] => 
    [contact_id] => 
    [assistant] => 
    [secondaryemail] => 
    [assistantphone] => 
    [donotcall] => 0
    [emailoptout] => 0
    [assigned_user_id] => 19x1
    [reference] => 0
    [notify_owner] => 0
    [createdtime] => 2019-05-05 19:20:48
    [modifiedtime] => 2019-08-05 14:32:01
    [modifiedby] => 19x1
    [portal] => 0
    [support_start_date] => 
    [support_end_date] => 
    [mailingstreet] => 
    [otherstreet] => 
    [mailingcity] => 
    [othercity] => 
    [mailingstate] => 
    [otherstate] => 
    [mailingzip] => 
    [otherzip] => 
    [mailingcountry] => 
    [othercountry] => 
    [mailingpobox] => 
    [otherpobox] => 
    [imagename] => 
    [description] => 
    [isconvertedfromlead] => 0
    [source] => WEBSERVICE
    [starred] => 0
    [tags] => 
    [cf_852] => 
    [cf_854] => 
    [cf_856] => 
    [cf_858] => 
    [cf_860] => 
    [cf_862] => 
    [cf_864] => 
    [cf_866] => 
    [cf_868] => 
    [cf_870] => 
    [cf_872] => 00:00
    [id] => 12x16
    [label] => 1111111
)

Observe that we have not passed any mandatory field value in the above call.

Note: id of the record is always required