Table of Contents |
---|
What for need CRM API
It need that external applications can programmatically add and receive data to CRM. To work with the API, you must configure the security key (password) and the rights of the user that will be connected.
Setting access to API
For access to API you need to specify the API Key (password) in the Administration/CRM/Integrations:
Access rights to CRM objects
To receive data via API, you can use different users with different access rights. Access rights to the objects defined in the Administration/CRM/Access:
Supported methods
Method's name | User right | Description |
---|---|---|
getcompanybyname | CRM Main Menu | Return company by name or ID |
To do some actions with CRM data you can use CRM API. Now we have authorization in API. For access in API you need:
- apiKey (Set in CRM Administration panel in Access inlay.)
- userName (Login of JIRA's user, which will perform all actions)
As now all actions will be performed under the JIRA's user, he owe to have all rights for access to methods (that rights are too in Access)
getcontactbyname | CRM Main Menu | Return |
contact by name or ID | ||
getcompanies | CRM Main Menu | Return |
all |
companies | ||
getcontacts | CRM Main Menu | Return |
all contacts | |
sync | CRM Main Menu |
Start synchronization of JIRA users | |
setcrmproperties | CRM Main Menu |
Set custom field type "Crm Property" in issue | |
addcompany | Add companies |
Add company | ||
addcontact | Add contact | Add contacts |
setcontact | Add exising contact to company | Set company for contacts |
How now owe to look method's calls :
...
adddictionaryvalue | Add the values to dictionaries | Add new value to a custom dictionary | ||
removedictionaryvalue | Remove the values from dictionaries | Remove value from a custom dictionary | ||
searchentities | Search CRM objects by parameters | Search CRM objects by parameters | ||
editcontact | Edit contacts | Ability to pass value parameters to the api methods by field codes or by field names | ||
editcompany | Edit companies | Ability to pass value parameters to the api methods by field codes or by field names | ||
updateOrCreateEntity | Add / Edit Objects | Example:
tableName - record type crm_param_1 - name of the first field crm_param_1_value - value of the first field Also, you can set the id for the existing record. | ||
transactionsList | Search CRM transactions | Search CRM transactions by given parameters |
Calls examples
...
...
Register organization "Adobe" to contact "Ted Johnson":
...
http:
//
...
YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=setcontact&companyName=Adobe&contactName=TedJohnson
...
Add contact with ID=6 to organization with ID=15:
http:
//
...
YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=setcontact&companyId=15&contactId=6
...
Add contact with the specified attributes.
...
http:
//YOURDOMAIN/
plugins/servlet/crm
...
/api?command=addcontact&userName=${userName}&apiKey=${apiKey}&clients-contact_name=new contact&clients-contact_company=newCompany&view-clients-contact_company=newCompany&clients-contact_email=new@new.com
Add company with the specified attributes.
http:
//YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=addcompany&clients-org_name=test
...
Company Name&clients-org_www=test.com&tableName=CLIENTS&view-clients-org_industry=Consulting&view-clients-org_sla=SLA-1
...
Free
...
$ {apiKey} need replace on key's value adjusted in Plugin administration panel.
$ {userName} need replace on JIRA user's login.
Here is an examples of a new method's calls.
...
Receive all organizations:
http:
//YOURDOMAIN/plugins/servlet/crm/api?apiKey=${apiKey}&userName=${userName}&command=getcompanies
Receive all contacts:
http:
//YOURDOMAIN/plugins/servlet/crm/api?apiKey=${apiKey}&userName=${userName}&command=getcontacts
Receive organization with ID=2:
http:
//YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=
...
Receive organization with name "Teamlead":
...
http:
//
...
YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=
...
getcompanybyname&companyName=Teamlead
Receive contact with ID=2:
...
http:
//
...
YOURDOMAIN/plugins/servlet/crm/api?
...
apiKey=${apiKey}&userName=${userName}&command=
...
...
...
Receive contact with name "Vladimir Putin":
http:
//YOURDOMAIN/plugins/
...
Add value "Green" to the custom dictionary "Colors":
http:
//YOURDOMAIN
/plugins/servlet/crm/api?command=adddictionaryvalue&userName=${userName}&apiKey=${apiKey}&dictionaryName=Colors&newvalue=Green
Remove value "Green" from the custom dictionary "Colors":
http:
//YOURDOMAIN
/plugins/servlet/crm/api?command=removedictionaryvalue&userName=${userName}&apiKey=${apiKey}&dictionaryName=Colors&valuetoremove=Green
Search for all contacts of "Teamlead" organization:
http:
//YOURDOMAIN/plugins/servlet/crm/api?command
...
=searchEntities&crm_param_1=Company&crm_param_1_value=Teamlead&tableName=CONTACTS&userName=
${userName}&apiKey=${apiKey}
Edit contact:
...
http:
//YOURDOMAIN/plugins/servlet/crm
...
/api?
command=editcontact&apiKey=${apiKey}&userName=${userName}&contactId=${contactId}&view-clients-contact_position=${position}&clients-contact_position=${position}&clients-contact_email=${email}&clients-contact_login=${userName}
Edit company:
http:
//YOURDOMAIN
/plugins/servlet/crm/api?command=editcompany&apiKey=${apiKey}&userName=${userName
...
}&companyId=${companyId}&view-clients-clients_field_d1facd51-01e0-4a68-a4f3-4aa3641a590e=Development,Training&clients-clients_field_d1facd51-01e0-4a68-a4f3-4aa3641a590e=Development,Training
http:
//YOURDOMAIN
/plugins/servlet/crm/api?command=editcompany&apiKey=${apiKey}&userName=${userName}&companyId=${companyId}&clients-clients_field_d8927b73-09ba-4094-b281-af6738e4432d=testest
http://YOURDOMAIN
...
/plugins/servlet/crm/api?command=editcompany&apiKey=${apiKey}&userName=${userName}&
...
companyId=${companyId}&Сompany name=${companyName}
Search CRM transactions
http://YOURDOMAIN/plugins/servlet/crm/api?command=transactionslist&userName=${userName}&apiKey=${apiKey}&saleVal=${issuekey}
where:
${apiKey} - API Key (password) in the Administration/Plugins/CRM/Access
${userName} - JIRA user's login