XML Integration with FileMaker Pro

Status
Not open for further replies.

Mark Geerdes

Joined
Jan 29, 2018
Messages
2
Reaction score
0
I'm working on integrating with a custom app created in FileMaker Pro using the XML file. I would like some help with the authentication step.
FileMaker requires the header:
Content-Type "application/json”.
and a JSON payload via POST of the following variables:
[ "user" ;
[ "password" ;
[ "layout" ;

Here is the XML I"m using with edits to hide the actual data:
<Crm Name="CentralCommand" Version="1">
<Number Prefix="Off"/>
<Connection MaxConcurrentRequests="1"/>
<Parameters />
<Authentication Type="Scenario">
<Value>FMToken</Value>
</Authentication>
<Scenarios>
<Scenario id="FMToken">
<Request Url="https://fm.URL" RequestType="POST" Message="{&quot;user&quot;:&quot;userName&quot;,&quot;password&quot;:&quot;Password&quot;,&quot;layout&quot;:&quot;Client3cx&quot;}" ResponseType="Json"/>
<Rules />
<Variables>
<Variable Name="token">token</Variable>
</Variables>
<Outputs>
<Output Type="HeaderName" Value="FM-Data-token"/>
<Output Type="HeaderValue" Value="[token]"/>
</Outputs>
</Scenario>
<Scenario>
<Request Url="https://fm.URL" RequestType="POST" Message="{&quot;query&quot;:[{&quot;cPhone3cx&quot;: &quot;[Number]&quot;}] }" ResponseType="Json"/>
<Rules />
<Variables>
<Variable Name="FirstName">data[0].fieldData.NameF</Variable>
<Variable Name="LastName">data[0].fieldData.NameL</Variable>
<Variable Name="Email">data[0].fieldData.Email</Variable>
<Variable Name="ClientID">data[0].fieldData.CLIENT::__ID</Variable>
<Variable Name="PhoneMobile">data[0].fieldData.PhoneMobile</Variable>
<Variable Name="PhoneBusiness">data[0].fieldData.PhoneWork</Variable>
<Variable Name="CompanyName">data[0].fieldData.CLIENT::ClientName</Variable>
</Variables>
<Outputs AllowEmpty="False">
<Output Type="FirstName" Value="[FirstName]" />
<Output Type="LastName" Value="[LastName]" />
<Output Type="Email" Value="" />
<Output Type="PhoneMobile" Value="[PhoneMobile]" />
<Output Type="PhoneBusiness" Value="[PhoneBusiness]" />
<Output Type="CompanyName" Value="[CompanyName]" />
<Output Type="ContactURL" Value="FMP://fm.URL]" />
</Outputs>
</Scenario>
</Scenarios>
</Crm>

Here's the log that I got when testing
2018/02/17 07:21:00.343|31310|0003|Trc|Request starting HTTP/1.0 GET [URL='http://tbd3cx.mn.3cx.us/api/CrmList/test?num=61228882626&ext=%3CExt%3E']http://domainName/api/CrmList/test?num=61228882626&ext=%3CExt%3E[/URL]

2018/02/17 07:21:00.346|31310|0003|Trc|AuthenticationScheme: Cookies was successfully authenticated.

2018/02/17 07:21:00.347|31310|0003|Trc|AuthenticationScheme: Cookies was successfully authenticated.

2018/02/17 07:21:00.349|31310|0003|Trc|Webclient was not authenticated. Failure message: No principal.

2018/02/17 07:21:00.349|31310|0003|Trc|Authorization was successful for user: voipadmin.

2018/02/17 07:21:00.350|31310|0003|Trc|Authorization was successful for user: voipadmin.

2018/02/17 07:21:00.351|31310|0003|Trc|Executing action method ManagementConsoleJS.Controllers.CrmListController.Test (ManagementConsoleJS) with arguments (61228882626, <Ext>) - ModelState is Valid

2018/02/17 07:21:00.352|31310|0003|Trc|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.

2018/02/17 07:21:00.352|31310|0003|Trc|Executed action ManagementConsoleJS.Controllers.CrmListController.Test (ManagementConsoleJS) in 5.5961ms

2018/02/17 07:21:00.352|31310|0003|Trc|Request finished in 9.6472ms 204



2018/02/17 07:28:33.841|31310|0014|Trc|Request starting HTTP/1.0 GET [URL='http://tbd3cx.mn.3cx.us/api/CrmList/test?num=6122802760&ext=%3CExt%3E']http://domainName/api/CrmList/test?num=6122802760&ext=%3CExt%3E[/URL]

2018/02/17 07:28:33.853|31310|0014|Trc|AuthenticationScheme: Cookies signed out.

2018/02/17 07:28:33.854|31310|0014|Trc|Request finished in 12.9816ms 401
 
Hello @Mark Geerdes,

The server side engine currently doesn't support sending requests with Content-Type "application/json”, just checked it and it's only sending "application/x-www-form-urlencoded" when you set the Post Values for the request. But when you use the Message property, no Content-Type is sent with the request.

We'll improve this in the upcoming updates of 3CX...

Kind regards.
 
However, if the server doesn't check the Content-Type and assumes that it is JSON, then it should work.
 
Can you explain the authentication precedure in more detail? Is it OAuth2? The authentication based on a scenario assumes that it is OAuth2, and will follow that authentication flow. If you need something different, then maybe you need a different approach...

What does the authentication server return? A Bearer to use in upcoming requests? Can you elaborate a bit on this?
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,473
Latest member
NathanMitchell