Bitrix24 Community

Support » Forum » Pawel Kochanowski
Select date in calendarSelect date in calendar

Pages: 1
Bitrix API, Documentation
[QUOTE]Ann Slyshkina wrote:
The REST API can be used to import leads to CRM only.

Creating leads in the CRM from external services can be done using the special-purpose page:
"your_name".bitrix24.com/crm/configs/import/lead.php

For a lead to be added to the CRM you must:
Call this page with a GET or POST method
Pass at least 3 required parameters: login and password of the user who is the creator of the lead, and the title of the lead.
The script will return a JSON-object with the parameters code and error_message.

! We recommend using a separate user with access only to add leads and without access to anything else.[TABLE][TR][TD] Code [/TD][TD] Description [/TD][/TR][TR][TD]400[/TD][TD]Parameters missing or parameters invalid [/TD][/TR][TR][TD]403[/TD][TD]Authorization or access error [/TD][/TR][TR][TD]201[/TD][TD]Lead added[/TD][/TR][/TABLE]Table 2: Parameters[TABLE][TR][TD] Parameter [/TD][TD] Type [/TD][TD] Description [/TD][/TR][TR][TD]LOGIN* [/TD][TD]S tring[/TD][TD]Login[/TD][/TR][TR][TD]PASSWORD* [/TD][TD]S tring[/TD][TD]Password [/TD][/TR][TR][TD]TITLE*[/TD][TD]S tring[/TD][TD]Title[/TD][/TR][TR][TD]COMPANY_TITLE [/TD][TD]S tring[/TD][TD]Company Name[/TD][/TR][TR][TD]NAME[/TD][TD]S tring[/TD][TD]First Name[/TD][/TR][TR][TD]LAST_NAME [/TD][TD]S tring[/TD][TD]Last Name[/TD][/TR][TR][TD]SECOND_NAME[/TD][TD]S tring[/TD][TD]Second Name[/TD][/TR][TR][TD]POST[/TD][TD]S tring[/TD][TD]Position[/TD][/TR][TR][TD]ADDRESS[/TD][TD]S tring[/TD][TD]Address[/TD][/TR][TR][TD]COMMENTS[/TD][TD]S tring[/TD][TD]Comment[/TD][/TR][TR][TD]SOURCE_DESCRIPTION[/TD][TD]S tring[/TD][TD]Source Description[/TD][/TR][TR][TD]STATUS_DESCRIPTION[/TD][TD]S tring[/TD][TD]Status Description[/TD][/TR][TR][TD]OPPORTINUTY[/TD][TD]Double[/TD][TD]Opportunity[/TD][/TR][TR][TD]CURRENCY_ID[/TD][TD]S tring[/TD][TD]Currency[/TD][/TR][TR][TD]PRODUCT_ID[/TD][TD]S tring[/TD][TD]Product[/TD][/TR][TR][TD]SOURCE_ID[/TD][TD]S tring[/TD][TD]Source[/TD][/TR][TR][TD]STATUS_ID[/TD][TD]S tring[/TD][TD]Lead Status[/TD][/TR][TR][TD]ASSIGNED_BY_ID[/TD][TD]Int[/TD][TD]Responsible[/TD][/TR][TR][TD]PHONE_WORK[/TD][TD]S tring[/TD][TD]Work Phone[/TD][/TR][TR][TD]PHONE_MOBILE[/TD][TD]S tring[/TD][TD]Mobile[/TD][/TR][TR][TD]PHONE_FAX[/TD][TD]S tring[/TD][TD]Fax[/TD][/TR][TR][TD]PHONE_HOME[/TD][TD]S tring[/TD][TD]Home Phone[/TD][/TR][TR][TD]PHONE_PAGER[/TD][TD]S tring[/TD][TD]Pager[/TD][/TR][TR][TD]PHONE_OTHER[/TD][TD]S tring[/TD][TD]Other Phone[/TD][/TR][TR][TD]WEB_WORK[/TD][TD]S tring[/TD][TD]Corporate Site[/TD][/TR][TR][TD]WEB_HOME[/TD][TD]S tring[/TD][TD]Personal Site[/TD][/TR][TR][TD]WEB_FACEBOOK[/TD][TD]S tring[/TD][TD]Facebook Page[/TD][/TR][TR][TD]WEB_LIVEJOURNAL[/TD][TD]S tring[/TD][TD]LiveJournal Page[/TD][/TR][TR][TD]WEB_TWITTER[/TD][TD]S tring[/TD][TD]Twitter Account[/TD][/TR][TR][TD]WEB_OTHER [/TD][TD]S tring[/TD][TD]Other Site [/TD][/TR][TR][TD]EMAIL_WORK[/TD][TD]S tring[/TD][TD]Work E-mail[/TD][/TR][TR][TD]EMAIL_HOME[/TD][TD]S tring[/TD][TD]Personal E-mail[/TD][/TR][TR][TD]EMAIL_OTHER[/TD][TD]S tring[/TD][TD]Other E-mail[/TD][/TR][TR][TD]IM_SKYPE[/TD][TD]S tring[/TD][TD]Skype[/TD][/TR][TR][TD]IM_ICQ[/TD][TD]S tring[/TD][TD]ICQ[/TD][/TR][TR][TD]IM_MSN[/TD][TD]S tring[/TD][TD]MSN/Live![/TD][/TR][TR][TD]IM_JABBER[/TD][TD]S tring[/TD][TD]Jabber[/TD][/TR][TR][TD]IM_OTHER[/TD][TD]S tring[/TD][TD]Other Messenger[/TD][/TR][/TABLE]* - required parameter

The STATUS_ID , SOURCE_ID , CURRENCY_ID, and PRODUCT_ID parameters are sel ected from a corresponding directory of the CRM.

Below are tables with value sets of these parameters after installation of the module.
Important : values can be changed by the intranet administrator or deleted.

Table 3: STATUS_ID – Lead Statuses[TABLE][TR][TD] Value [/TD][TD] Description [/TD][/TR][TR][TD]NEW[/TD][TD]Unassigned[/TD][/TR][TR][TD]ASSIGNED[/TD][TD]Responsible Assigned[/TD][/TR][TR][TD]DETAILS[/TD][TD]Waiting for Details[/TD][/TR][TR][TD]CANNOT_CONTACT[/TD][TD]Cannot Contact[/TD][/TR][TR][TD]IN_PROCESS[/TD][TD]In Progress[/TD][/TR][TR][TD]ON_HOLD[/TD][TD]On Hold[/TD][/TR][TR][TD]RESTORED[/TD][TD]Restored[/TD][/TR][TR][TD]CONVERTED[/TD][TD]Converted[/TD][/TR][TR][TD]JUNK[/TD][TD]Junk Lead[/TD][/TR][/TABLE]Table 4: SOURCE_ID – Sources[TABLE][TR][TD] Value [/TD][TD] Description [/TD][/TR][TR][TD]SELF[/TD][TD]Personal Contact[/TD][/TR][TR][TD]PARTNER[/TD][TD]Existing Client[/TD][/TR][TR][TD]CALL[/TD][TD]Call[/TD][/TR][TR][TD]WEB[/TD][TD]Website[/TD][/TR][TR][TD]EMAIL[/TD][TD]E-Mail[/TD][/TR][TR][TD]CONFERENCE[/TD][TD]Conference[/TD][/TR][TR][TD]TRADE_SHOW[/TD][TD]Show/Exhibition[/TD][/TR][TR][TD]EMPLOYEE[/TD][TD]Employee[/TD][/TR][TR][TD]COMPANY[/TD][TD]Campaign[/TD][/TR][TR][TD]HR[/TD][TD]HR Department[/TD][/TR][TR][TD]MAIL[/TD][TD]E-Mail Message [/TD][/TR][TR][TD]OTHER[/TD][TD]Other[/TD][/TR][/TABLE]Table 5: CURRENCY_ID – Currencies[TABLE][TR][TD] Value
[/TD][TD] Description
[/TD][/TR][TR][TD]USD
[/TD][TD]US Dollar [/TD][/TR][TR][TD]EUR
[/TD][TD]Euro
[/TD][/TR][/TABLE]Table 6: PRODUCT_ID – Products[TABLE][TR][TD] Value
[/TD][TD] Description
[/TD][/TR][TR][TD]PRODUCT_1
[/TD][TD]Bitrix Site Manager
[/TD][/TR][TR][TD]PRODUCT_2
[/TD][TD]Bitrix Intranet
[/TD][/TR][TR][TD]OTHER
[/TD][TD]Other
[/TD][/TR][/TABLE]Aside fr om the main fields, a lead may have additional custom fields created by the CRM administrator. They can also be passed to the page.
[/QUOTE]Dear Ann,

I have a problem with send of data from parameter "PRODUCT_ID":

[B]1. Add product "TEST" (ID:30)[/B]

[IMG]http://www.pkis.co.uk/bx24.png[/IMG]

[B]2. Add "'PRODUCT_ID' => $leadData['PRODUCT_ID'],"[/B]

[CODE] // get lead data from the form
$postData = array(
'TITLE' => $leadData['TITLE'],
'EMAIL_HOME' => $leadData['EMAIL_HOME'],
'NAME' => $leadData['NAME'],
'LAST_NAME' => $leadData['LAST_NAME'],
'PHONE_MOBILE' => $leadData['PHONE_MOBILE'],
'PRODUCT_ID' => $leadData['PRODUCT_ID'],
'CURRENCY_ID' => $leadData['CURRENCY_ID'],
);
[/CODE][B]3. Add form fild[/B]

[CODE]// HTML form
<input type="hidden" name="DATA[PRODUCT_ID]" value="30" />[/CODE]or
[CODE] // HTML form
<input type="hidden" name="DATA[PRODUCT_ID]" value="TEST" />[/CODE]

All data is stored in new Lead except for the product. What is wrong?
Edited: Pawel Kochanowski - 11/22/2013 22:42:42
Pages: 1
2,000,000+
organizations
are already using Bitrix24