CRM Intergration Editor REST API not working correctly

Status
Not open for further replies.

allvi

Joined
Jan 3, 2019
Messages
3
Reaction score
0
I have a CRM with a REST API and tried to use your CRM Intergration Editor.
I configured the CRM Editor as described in https://www.3cx.de/blog/crm-telefonanlage-integration/ and https://www.3cx.com/docs/crm-integration/.
I have two REST services with sligthly different responses. But both services returns a json with for example the attributes email and id. Now the problem is that one response matches in the response tree and one not even if the returned json attributes (i.e. email) and the CRM Editor template are the same.

For this REST response I get a match for id and email:
[{"email":"[email protected]","firmaId":1381,"firstname":"Sia","id":29,"invitationallvisaapero":true,"lastname":"Ruh","phone":"+43 41 493 01 03","referencelist":false,"salutation":"Frau","sex":1,"useprivateaddress":false}]

For this one I have no match for id and email:
[{"company":"Al AG","email":"[email protected]","firstName":"Sia","id":29,"lastName":"Ruh","phoneDirect":"+43 41 493 01 03","phoneFirm":"+43 44 436 01 10"}]

Do you have an idea where the problem could be?

And even if I have a match for the first one in the "response tree" and in the "variables" tab there is no entry in the "output" tab of the CRM Intergration Editor.
 
We would have to see the XML template in order to understand why this is not working as you expect...
 
The attached template has a matching for the "email" and "id" attribute in the first JSON response but not in the second one (see example above).
 

Attachments

The problem is that you have a Rule to identify records having a property "phone":
Code:
      <Rules>
        <Rule Type="Number">phone</Rule>
      </Rules>

The first JSON response has that property, and that's why it works. However, the second JSON response doesn't have it. Instead it has phoneDirect and phoneFirm.

The Rule elements that you define inside a Rules element are evaluated with an OR condition. So you can add another Rule element for the other case:
Code:
      <Rules>
        <Rule Type="Number">phone</Rule>
        <Rule Type="Number">phoneDirect</Rule>
        <Rule Type="Number">phoneFirm</Rule>
      </Rules>

Also, in order to get the record as a valid result in the Outputs, you need to create an output with the phone number that is calling, otherwise it will not be considered. So, add the following output:
Code:
      <Outputs Next="" AllowEmpty="false">
        <Output Type="ContactUrl" Value="http://localhost:8080/crm2/resources/customercontactpersons/[ID]" />
        <Output Type="Email" Value="[email]" />
        <Output Type="PhoneBusiness" Value="[Number]" />
      </Outputs>

Hope it helps.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei