API error asking for Delta Field

stubh

Titanium Partner
Basic Certified
Joined
Dec 5, 2024
Messages
20
Reaction score
14
I am setting up for some API requests and I keep getting an error message asking for a "delta" field value. I am able to get an auth token, and am able to make a few get requests and am seeing the expected output data, but when I make a post request, it keeps failing. I could not find anything on the GitHub repo mentioning a delta value, or on the page for the config documents.

https://www.3cx.com/docs/configuration-rest-api-endpoints/#h.kj2s8xpn0hts

Has anyone encountered this and if so, how did you solve this?
 
Hello,

No problem known to me.

Can you please clarify the folowing details:
-Version 3CX server (example v20 update 6 release 721 Beta)
-Type of installation / license (example private cloud 16 pro)
-Used programming language (example linux python)
-Example of POST function used (example GeneralSettingsForApps)

I understand it seems general, still it would be good to drill down to where the problem occours.

If possible, i will try to replicate

Paulo
 
Last edited:
  • Like
Reactions: stubh
Hello,

Daily using 150+ servers, in this way with mass changes.
No problem known to me.

Can you please clarify the folowing details:
-Version 3CX server (example v20 update 6 release 721 Beta)
-Type of installation / license (example private cloud 16 pro)
-Used programming language (example linux python)
-Example of POST function used (example GeneralSettingsForApps)

I understand it seems general, still it would be good to drill down to where the problem occours.

If possible, i will try to replicate

Paulo
Getting it on two server instances.
I am having the issue in two instances that I am testing.

Version 20.0 Update 6 (Build 486 Alpha)
Type Enterprise Annual On Premise

Version 20.0 Update 5 (Build 551 Release)
Type Enterprise Annual On Premise

Both Give the same error

Language Python, but having it the automation software we are using as well. But if I can get it in python, I can work backwards to get it to our autotmation software.

POST method being called is the xapi/v1/contacts for the
CreateContact operationId based on the swagger.

Let me know if you need any more information from me
 
Hello,

Send first to check extension (example of GET):

https://{{PBX_FQDN}}/xapi/v1/Users(65)
JSON:
{
    "@odata.context": "https://{{PBX_FQDN}}:{{PORT}}/xapi/v1/$metadata#Users/$entity",
    "Enable2FA": false,
    "Require2FA": false,
    "MyPhoneShowRecordings": false,
    "MyPhoneAllowDeleteRecordings": false,
    "MyPhoneHideForwardings": false,
    "MyPhonePush": true,
    "RecordCalls": false,
    "AllowOwnRecordings": true,
    "RecordExternalCallsOnly": false,
    "RecordEmailNotify": false,
    "PrimaryGroupId": 3,
    "FirstName": "",
    "LastName": "extension",
    "DisplayName": "extension",
    "EmailAddress": "",
    "Mobile": "",
    "WebMeetingFriendlyName": "",
    "WebMeetingApproveParticipants": false,
    "SendEmailMissedCalls": false,
    "VMEnabled": false,
    "VMEmailOptions": "None",
    "VMPIN": "",
    "VMDisablePinAuth": false,
    "VMPlayCallerID": false,
    "VMPlayMsgDateTime": "None",
    "ContactImage": "",
    "IsRegistered": false,
    "CurrentProfileName": "Available",
    "QueueStatus": "LoggedIn",
    "AuthID": "",
    "DeskphonePassword": "",
    "AuthPassword": "",
    "OutboundCallerID": "",
    "Blfs": "<PhoneDevice><BLFS/></PhoneDevice>",
    "OfficeHoursProps": [
        "GlobalSchedule"
    ],
    "Language": "en",
    "Internal": false,
    "Enabled": true,
    "PromptSet": "",
    "HideInPhonebook": true,
    "Tags": [],
    "PinProtected": false,
    "PinProtectTimeout": 0,
    "CallScreening": false,
    "AllowLanOnly": true,
    "SIPID": "",
    "MS365SignInEnabled": true,
    "MS365ContactsEnabled": true,
    "MS365CalendarEnabled": true,
    "MS365TeamsEnabled": true,
    "GoogleSignInEnabled": false,
    "GoogleContactsEnabled": true,
    "GoogleCalendarEnabled": true,
    "EnableHotdesking": false,
    "SRTPMode": "SRTPDisabled",
    "PbxDeliversAudio": false,
    "EmergencyLocationId": "",
    "EmergencyAdditionalInfo": "",
    "CallUsRequirement": "Both",
    "CallUsEnablePhone": false,
    "CallUsEnableChat": false,
    "CallUsEnableVideo": false,
    "ClickToCallId": "",
    "Number": "111",
    "TranscriptionMode": "Inherit",
    "Id": 65,
    "Hours": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    },
    "BreakTime": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    }
}


Then send POST to create new user:

https://{{PBX_FQDN}}/xapi/v1/Users
JSON:
{
    "AccessPassword": "QrzxYQwa5!",
    "EmailAddress": "[email protected]",
    "FirstName": "TestFirstName",
    "Id": 0,
    "Language": "EN",
    "LastName": "TestLastName",
    "Number": "211",
    "PromptSet": "1e6ed594-af95-4bb4-af56-b957ac87d6d7",
    "SendEmailMissedCalls": true,
    "VMEmailOptions": "Notification",
    "Require2FA": true
}


Response from the POST above:
JSON:
{
    "@odata.context": "https://{{PBX_FQDN}}:{{PORT}}/xapi/v1/$metadata#Users/$entity",
    "Enable2FA": false,
    "Require2FA": true,
    "MyPhoneShowRecordings": false,
    "MyPhoneAllowDeleteRecordings": false,
    "MyPhoneHideForwardings": false,
    "MyPhonePush": true,
    "RecordCalls": false,
    "AllowOwnRecordings": true,
    "RecordExternalCallsOnly": false,
    "RecordEmailNotify": false,
    "PrimaryGroupId": -1,
    "FirstName": "TestFirstName",
    "LastName": "TestLastName",
    "DisplayName": "TestFirstName TestLastName",
    "EmailAddress": "[email protected]",
    "Mobile": "",
    "WebMeetingFriendlyName": "",
    "WebMeetingApproveParticipants": false,
    "SendEmailMissedCalls": true,
    "VMEnabled": true,
    "VMEmailOptions": "Notification",
    "VMPIN": "365594",
    "VMDisablePinAuth": false,
    "VMPlayCallerID": false,
    "VMPlayMsgDateTime": "None",
    "ContactImage": "",
    "IsRegistered": false,
    "CurrentProfileName": "Available",
    "QueueStatus": "LoggedIn",
    "AuthID": "",
    "DeskphonePassword": "",
    "AuthPassword": "",
    "OutboundCallerID": "",
    "Blfs": "",
    "OfficeHoursProps": [
        "GlobalSchedule"
    ],
    "Language": "EN",
    "Internal": false,
    "Enabled": true,
    "PromptSet": "1e6ed594-af95-4bb4-af56-b957ac87d6d7",
    "HideInPhonebook": false,
    "Tags": [],
    "PinProtected": false,
    "PinProtectTimeout": 60,
    "CallScreening": false,
    "AllowLanOnly": true,
    "SIPID": "",
    "MS365SignInEnabled": true,
    "MS365ContactsEnabled": true,
    "MS365CalendarEnabled": true,
    "MS365TeamsEnabled": true,
    "GoogleSignInEnabled": true,
    "GoogleContactsEnabled": true,
    "GoogleCalendarEnabled": true,
    "EnableHotdesking": false,
    "SRTPMode": "SRTPDisabled",
    "PbxDeliversAudio": false,
    "EmergencyLocationId": "",
    "EmergencyAdditionalInfo": "",
    "CallUsRequirement": "Both",
    "CallUsEnablePhone": false,
    "CallUsEnableChat": false,
    "CallUsEnableVideo": false,
    "ClickToCallId": "",
    "Number": "211",
    "TranscriptionMode": "Inherit",
    "Id": 207,
    "Hours": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    },
    "BreakTime": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    }
}

Hope this helps

Paulo
 
Last edited:
  • Like
Reactions: stubh
Hello,

Send first to check extension (example of GET):

https://{{PBX_FQDN}}/xapi/v1/Users(63)
XML:
{
    "@odata.context": "https://{{PBX_FQDN}}:{{PORT}}/xapi/v1/$metadata#Users/$entity",
    "Enable2FA": false,
    "Require2FA": false,
    "MyPhoneShowRecordings": false,
    "MyPhoneAllowDeleteRecordings": false,
    "MyPhoneHideForwardings": false,
    "MyPhonePush": true,
    "RecordCalls": false,
    "AllowOwnRecordings": true,
    "RecordExternalCallsOnly": false,
    "RecordEmailNotify": false,
    "PrimaryGroupId": 36,
    "FirstName": "",
    "LastName": "extension",
    "DisplayName": "extension",
    "EmailAddress": "",
    "Mobile": "",
    "WebMeetingFriendlyName": "",
    "WebMeetingApproveParticipants": false,
    "SendEmailMissedCalls": false,
    "VMEnabled": false,
    "VMEmailOptions": "None",
    "VMPIN": "",
    "VMDisablePinAuth": false,
    "VMPlayCallerID": false,
    "VMPlayMsgDateTime": "None",
    "ContactImage": "",
    "IsRegistered": false,
    "CurrentProfileName": "Available",
    "QueueStatus": "LoggedIn",
    "AuthID": "",
    "DeskphonePassword": "",
    "AuthPassword": "",
    "OutboundCallerID": "",
    "Blfs": "<PhoneDevice><BLFS/></PhoneDevice>",
    "OfficeHoursProps": [
        "GlobalSchedule"
    ],
    "Language": "nl",
    "Internal": false,
    "Enabled": true,
    "PromptSet": "",
    "HideInPhonebook": true,
    "Tags": [],
    "PinProtected": false,
    "PinProtectTimeout": 0,
    "CallScreening": false,
    "AllowLanOnly": true,
    "SIPID": "",
    "MS365SignInEnabled": true,
    "MS365ContactsEnabled": true,
    "MS365CalendarEnabled": true,
    "MS365TeamsEnabled": true,
    "GoogleSignInEnabled": false,
    "GoogleContactsEnabled": true,
    "GoogleCalendarEnabled": true,
    "EnableHotdesking": false,
    "SRTPMode": "SRTPDisabled",
    "PbxDeliversAudio": false,
    "EmergencyLocationId": "",
    "EmergencyAdditionalInfo": "",
    "CallUsRequirement": "Both",
    "CallUsEnablePhone": false,
    "CallUsEnableChat": false,
    "CallUsEnableVideo": false,
    "ClickToCallId": "admin",
    "Number": "100",
    "TranscriptionMode": "Inherit",
    "Id": 63,
    "Hours": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    },
    "BreakTime": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    }
}


Then send POST to create new user:

https://{{PBX_FQDN}}/xapi/v1/Users
XML:
{
    "AccessPassword": "QrzxYQwa5!",
    "EmailAddress": "[email protected]",
    "FirstName": "TestFirstName",
    "Id": 0,
    "Language": "EN",
    "LastName": "TestLastName",
    "Number": "211",
    "PromptSet": "1e6ed594-af95-4bb4-af56-b957ac87d6d7",
    "SendEmailMissedCalls": true,
    "VMEmailOptions": "Notification",
    "Require2FA": true
}


Response from the POST above:
XML:
{
    "@odata.context": "https://{{PBX_FQDN}}:{{PORT}}/xapi/v1/$metadata#Users/$entity",
    "Enable2FA": false,
    "Require2FA": true,
    "MyPhoneShowRecordings": false,
    "MyPhoneAllowDeleteRecordings": false,
    "MyPhoneHideForwardings": false,
    "MyPhonePush": true,
    "RecordCalls": false,
    "AllowOwnRecordings": true,
    "RecordExternalCallsOnly": false,
    "RecordEmailNotify": false,
    "PrimaryGroupId": -1,
    "FirstName": "TestFirstName",
    "LastName": "TestLastName",
    "DisplayName": "TestFirstName TestLastName",
    "EmailAddress": "[email protected]",
    "Mobile": "",
    "WebMeetingFriendlyName": "",
    "WebMeetingApproveParticipants": false,
    "SendEmailMissedCalls": true,
    "VMEnabled": true,
    "VMEmailOptions": "Notification",
    "VMPIN": "365594",
    "VMDisablePinAuth": false,
    "VMPlayCallerID": false,
    "VMPlayMsgDateTime": "None",
    "ContactImage": "",
    "IsRegistered": false,
    "CurrentProfileName": "Available",
    "QueueStatus": "LoggedIn",
    "AuthID": "",
    "DeskphonePassword": "",
    "AuthPassword": "",
    "OutboundCallerID": "",
    "Blfs": "",
    "OfficeHoursProps": [
        "GlobalSchedule"
    ],
    "Language": "EN",
    "Internal": false,
    "Enabled": true,
    "PromptSet": "1e6ed594-af95-4bb4-af56-b957ac87d6d7",
    "HideInPhonebook": false,
    "Tags": [],
    "PinProtected": false,
    "PinProtectTimeout": 60,
    "CallScreening": false,
    "AllowLanOnly": true,
    "SIPID": "",
    "MS365SignInEnabled": true,
    "MS365ContactsEnabled": true,
    "MS365CalendarEnabled": true,
    "MS365TeamsEnabled": true,
    "GoogleSignInEnabled": true,
    "GoogleContactsEnabled": true,
    "GoogleCalendarEnabled": true,
    "EnableHotdesking": false,
    "SRTPMode": "SRTPDisabled",
    "PbxDeliversAudio": false,
    "EmergencyLocationId": "",
    "EmergencyAdditionalInfo": "",
    "CallUsRequirement": "Both",
    "CallUsEnablePhone": false,
    "CallUsEnableChat": false,
    "CallUsEnableVideo": false,
    "ClickToCallId": "",
    "Number": "211",
    "TranscriptionMode": "Inherit",
    "Id": 207,
    "Hours": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    },
    "BreakTime": {
        "Type": "OfficeHours",
        "IgnoreHolidays": false,
        "Periods": []
    }
}

Hope this helps

Paulo
That is what I have been doing. I making the get request for users or contacts and it will give me everything out. But when I make a post request I am getting back this error for making a new users with the text XML you provided. I get that with make contact, and make user. I have not tried update as of yet.

{'response': {'error': {'code': '', 'message': 'The input was not valid.\n\ndelta:\nThe delta field is required.', 'details': [{'code': '', 'message': 'The input was not valid.'}, {'code': '', 'message': 'The delta field is required.', 'target': 'delta'}]}}, 'status': 400}
 
Hi,

sorry to hear this.
So if everything is good, it must be some 3CX server installation f-ck-up or database corruption.

My personal next step would be backup of 3CX, re-install Linux, re-install 3CX- Restore Backup - try again.
But that's me, not sure if this is an option for your setup.

Paulo
 
Last edited:
  • Like
Reactions: stubh
Made a few tweaks to the request. I was able to get make contact working, which for the project I am on, gets me moving, so I will go from there. Still not able to create a user, gives the same delta field error. Which is a bit annoying since it works for one but not the other. I appreciate the help!
 
Hi,

do you know the appication POSTMAN.
With Postman, you can test the send and receive of GET and POST messages and 'see' what is happening.

Normally I test it in Postmann, and than it should work in my own APP... if not it's a long night xD for me.

If you do use it, than i am sorry to have mention it, but great to hear you are onboard.

Paulo
 
I use python, I should spin up a postman instance for myself specifically for this project since I know once I get this up and running, there is going to be a lot of demand to automate stuff. Since each org has their own FDQN and secret, how are you handling that generally to access and make global changes easily and scalably?
 
Hello,

I work in PHP (website)

Paulo
 
What fixed it at least for getting contacts made and deleted was having a unique header for the auth with was using
content-type application/x-www-form-urlencoded and then all other things use the application/json in the header. Still throws the delta field error when trying to make a new user, but that is a different problem for a different day.
 

Latest Posts

Forum statistics

Threads
111,962
Messages
589,980
Members
164,864
Latest member
SCarpenter@fifthavenue-la