401 Unauthorized Error with 3CX API Despite Correct API Key

Status
Not open for further replies.

MayurMali

Free User
Basic Certified
Joined
Feb 28, 2024
Messages
7
Reaction score
0
I am developing an integration between 3CX and Google Sheets to automatically fetch call recordings and details (such as caller ID, callee ID, call duration, and recording URL) based on phone numbers listed in a Google Sheet. I am encountering a 401 Unauthorised error when attempting to access the 3CX API, despite using the correct API key. I have verified the API key and its permissions, but the issue persists. Here are the details of my setup and troubleshooting steps:

Details:
Endpoint URL: https://bassprac.3cx.com.au:5001/api/CallControl
Request Method: POST (also tested with GET)
Headers:
Authorization: Bearer MY API KEY
Content-Type: application/xml
 
I am developing an integration between 3CX and Google Sheets to automatically fetch call recordings and details (such as caller ID, callee ID, call duration, and recording URL) based on phone numbers listed in a Google Sheet. I am encountering a 401 Unauthorised error when attempting to access the 3CX API, despite using the correct API key. I have verified the API key and its permissions, but the issue persists. Here are the details of my setup and troubleshooting steps:

Details:
Endpoint URL: https://bassprac.3cx.com.au:5001/api/CallControl
Request Method: POST (also tested with GET)
Headers:
Authorization: Bearer MY API KEY
Content-Type: application/xml
Where did you find this endpoint? The Call Control web API isn't there yet AFAIK.
 
Hey, thanks for the reply. Then how can I build the integration?
 
Hey, thanks for the reply. Then how can I build the integration?
You need to use other endpoints. In your case, might be easier to use the CRM Integration with a custom script to talk to Google Sheets. Otherwise, check the ReportCallLogData endpoint.
 
Thanks again. Can you guide me where can I find ReportCallLogData endpoint, as I can't find proper documentation for 3cx to build my integration.
 
i am getting 401Unauthorized error and i can't figure out what the issue might be

endpoint i am using https://bassprac.3cx.com.au:5001/api/ReportCallLogData/Pbx.GetCallLogData

also pasting my xml script if it might help

XML Script:
<?xml version="1.0" encoding="utf-8"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="US" Name="3CX Call Integration" Version="1" SupportsEmojis="true" ListPageSize="0">
<Number Prefix="AsIs" MaxLength="11" />
<Connection MaxConcurrentRequests="2" />
<Parameters>
<Parameter Name="APIkey" Type="String" Parent="General Configuration" Editor="String" Title="API Key:" />
</Parameters>
<Authentication Type="Basic">
<Value>API Key</Value>
</Authentication>
<Scenarios>
<Scenario Id="LookupByNumber" Type="REST">
<Request Url="https://bassprac.3cx.com.au:5001/api/ReportCallLogData/Pbx.GetCallLogData" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues Key="">
<Value Key="periodFrom" Passes="1" Type="String">2024-01-01T00:00:00</Value>
<Value Key="periodTo" Passes="1" Type="String">2024-07-01T23:59:59</Value>
<Value Key="sourceFilter" Passes="1" Type="String">[Number]</Value>
<Value Key="callsType" Passes="1" Type="String">All</Value>
<Value Key="hidePcalls" Passes="1" Type="Boolean">false</Value>
</PostValues>
<Response>
<Value Key="StartTime" Path="$.value[0].StartTime" />
<Value Key="SourceCallerId" Path="$.value[0].SourceCallerId" />
<Value Key="DestinationCallerId" Path="$.value[0].DestinationCallerId" />
<Value Key="TalkingDuration" Path="$.value[0].TalkingDuration" />
<Value Key="RecordingUrl" Path="$.value[0].RecordingUrl" />
</Response>
</Request>
</Scenario>
</Scenarios>
</Crm>
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,832
Messages
589,283
Members
164,662
Latest member
DejanMDS