Menu

Method naming principle.

Fruit and berry crops for the garden

The following conventions are accepted when using the Data API:

  • Empty fields are always returned in a null response. In the case of an array, an empty array is returned; in the case of an object, an empty object is returned;
  • All fields related to date and time are transmitted in the format YYYY-MM-DD hh: mm: ss;
  • API requests are always made using the POST method;
  • All parameters in requests / responses, as well as in data structures in JSON format and the names of methods are named in the Snake Case style - separating words through underscores;
  • Data is returned only in JSON format as per RFC 7159 specification. Accept header is ignored;
  • Data encoding UTF-8;
  • The Content-Type header must be "application / json; charset = UTF-8";
  • The Content-Length header must contain the correct message length, following the HTTP / 1.1 specification

Add an IP address to the allowed list

By default, access to the API is denied to everyone, so that you can make requests, you need to add the IP address of the host from which the request is made to the whitelist. This can be done through your personal account "Administrator -> Account -> Rules and security settings", "API" tab.

If you need to allow access to all IP addresses, then you need to add 0.0.0.0/0 to the list of allowed

If the request is made from under the agent, then its IP address must be added to the white list of the client account

API Users and Authentication

Users and access keys are subject to access rights similar to those in the personal account.

Key access

Keys are generated at the user level in the section "Account" → "User Management"
There are two types of keys:

  • Constant;
  • Temporary;

A permanent key has an unlimited duration.
A temporary key has a specific expiration date for the key.

Login and password access

Session authentication is used

Session lifetime is 1 hour.

API requests report

In your personal account "Reports" -> "Service" -> "API requests" you can build a report on API requests

Base URL for API access

The base URL for accessing the API follows the following pattern:

:// /

https: //dataapi.site/

Versioning

Current Data API 2.0

Data API supports versioning. The version is specified in the base URL as vX.Y, where X is the major version number, Y is the minor version number

If a new version was released, then the old one is considered obsolete and, accordingly, when accessing the old version of the API, the "current_version_deprecated" parameter with the value "true" will be returned in the meta-parameters (see the section)

The maximum number of versions supported is 2
Outdated version support period 2 months

Limits and restrictions

Points are deducted only for successful requests, i.e. in the report on API requests (see section) it is marked as successful.

Information about limits is returned in all answers in meta-parameters (see section), except for cases when limits are not taken into account;

The limits are based on a point system, that is, each method has its own weight. The method call decreases the available daily / minute points by the size of the weight of the called method

Information about limits in meta-parameters:

Methods and their cost in points

Expansion of limits

On the page "Account" -> "Tariffs and options" in your personal account, you can expand the limits.

Error processing

Error message options

Name Type of Mandatory Description
error object Yes Object with error content
code number Yes Non-unique error code (see section)
message string Yes Error message
data object Yes Object with error details
mnemonic string Yes Unique textual error code. It is recommended to use this parameter when handling errors.
value string No Contains what the user submitted unchanged
In some cases, it may be absent. For example, a required parameter was not filled at all.
extended_helper string No Link to a more detailed description of the error and possible solutions
params object No Parameter substitution map for template with error text. Those. contains dynamically changing values, for example, limits. The values ​​specified in this parameter can be used in error messages in the interface, which is based on the Data API.
field string No The name of the parameter with which the error is associated
Nested parameters are displayed separated by a period "."
For example: "employee.phone_number"

JSON structure of the error

("jsonrpc": "2.0", "id": null, "error": ("code": "number", "message": "string", "data": ("mnemonic": "string", " field ":" string "," value ":" string "," params ": (" object ":" string ")," extended_helper ":" string "," metadata ": ())))

Error code groups

Error code Description
-32700 JSON validation errors
-32600
-32601 Method related errors
-32602 Errors related to the validation of parameters in the called method
-32603 Internal JSON RPC Server Errors
-32001 Authentication Errors and Key Errors
-32003 Errors with access rights - the ip address is not in the whitelist, the user has no rights
-32004 Errors associated with the wrong sequence of called methods
-32007 Errors associated with the virtual number
-32008 Component errors
-32009 Account errors
-32029 Limit errors
-32099 Errors related to the support of various parts of the JSON RPC 2.0 specification - Bulk operations, Notifications

List of errors common to all methods

Text message Code Mnemonics Description
Invalid Request The JSON sent is not a valid Request object -32600 invalid_request Errors related to validation of request parameters - id, jsonrpc
Access token has been expired -32001 access_token_expired Applies to constant token only. If the lifetime of the constant token has expired, then the specified error is returned
Access token has been blocked -32001 access_token_blocked If the constant token is locked, then the specified error is returned
Access token is invalid -32001 access_token_invalid The specified error is returned if the permanent / temporary token is not found
Limit per (limit_type) has been exceeded. Value of current limit per (limit_type) is (limit_max_value) -32029 limit_exceeded Limit exceeded
You need at least on of the following components to access this method: (components) -32008 method_component_disabled If the component that is required for the method to work is not connected
You need at least on of the following components to access this paremeter: (components) -32008 parameter_component_disabled If the component is not connected, which is needed to fill the parameter and create the entity
Your IP (ip) is not whitelisted -32003 ip_not_whitelisted The IP address from which the request is made is not in the white list of addresses. If the request is made from under the agent, then your IP address must be in the lists of allowed addresses inside the client account
Login or password is wrong -32001 auth_error Incorrect login or password
Your account has been disabled, contact the support service -32009 account_inactive account is blocked
Internal error, contact the support service -32603 internal_error Internal error, you need to contact technical support
Data supplied is of wrong type -32602 data_type_error For example, if we expect string and passed int
The method does not exist / is not available -32601 method_not_found The called method was not found
Permission denied -32003 forbidden You do not have permission to access the method or API, or it is forbidden to perform any action
Invalid JSON was received by the server. -32700 parse_error JSON validation error
Batch operations not supported -32099 batch_opreations_not_supported Bulk operations are not supported
Notifications not supported -32099 notifications_not_supported The id parameter was lost in the request. See section
The required parameter has been missed -32602 required_parameter_missed Required parameter was not passed
Invalid parameter value -32602 invalid_parameter_value It is returned in all cases if an incorrect parameter value was passed or the passed value does not correspond to the required input format
Unexpected method parameter (s) -32602 unexpected_parameters If parameters were passed in "params" that are not provided by the JSON structure of the method, or a parameter for sorting, filtering and selecting that does not exist is specified
The combination of parameters is not permitted -32602 invalid_parameters_combination If the parameters specified in the method are in an invalid combination or have dependencies on each other. You need to look at the documentation on the method and its parameters.
(error_message) -32602 error Dynamic errors

List of errors for methods with get verb

Error text Code Mnemonics Description
Invalid parameter value -32602 invalid_parameter_value If an incorrect value was passed in the filters for regexp, jsquery or any values ​​that do not match the documentation
Sort by parameter is prohibited -32602 sort_prohibited Sorting by parameter is prohibited and impossible, since the parameter for sorting is not in the list of allowed for sorting
Filter by parameter is prohibited -32602 filter_prohibited Filtering by parameter is prohibited and impossible, since the parameter for filtering is not in the list of allowed for filtering
Max value of requested date interval is 3 months -32602 date_interval_limit_reached If in the request the period between the specified dates in date_from and date_till is more than 3 months. Basically, the error is relevant only for methods of receiving reports, but not for all.

List of errors common to methods with the delete verb

List of errors common to methods with the verb create and update, set, unset

Error text Code Mnemonics Description
Entity not found -32602 entity_not_found If passed a unique identifier of an entity that was not found
Duplicate entity -32602 duplicate_entity If the entity already exists
A new data limit has been exceeded -32602 data_limit_exceeded An error occurs if the maximum amount of data has been reached.
Action is not allowed for your tariff plan. You need contact support service or change your tariff plan settings in your account -32602 tariff_restrictions Any restrictions of the tariff plan
This value is already used by another entity -32602 already_in_use The value of the specified parameter is already in use in another entity. For example, the virtual number is already being used in another advertising campaign.

Group operations

Functionality not supported

Method naming convention

The JSON-RPC method name consists of two parts separated by a period: the verb and the object name.

The object name is selected as a plural noun to reflect the business entity, such as subscribers.

The method name must begin with a verb that reflects the essence of the operation.

Verbs used in method naming

Verb Description
create Adds an entity.
get Returns a list of sorted and filtered data using filter criteria and sorting methods. It is possible to apply a limit and pagination to the request on the amount of data received (see section). Using the filtering criteria, one record can also be obtained by its unique identifier (see section). In a special meta-parameter, the total number of records is returned (see section). Using a special parameter, you can specify which fields to return in the response message (see section).
update Updates an entity with a specific identifier.
Partial parameter update possible
When arrays are updated, the entire array is updated, that is, all elements that were not transferred are deleted.
To nullify an optional parameter, you need to pass null
delete Removes an entity with a specific identifier.
add The relationship of one object to another.
enable Object connection
disable Disable object
set Setting a property to another object, for example, setting a tag for a call
unset Removing a property from another object, for example, removing a tag from a call

Filtration criteria

Data filtering applies only to the "get" verb (see section using the optional "filter" primitive, which is an object and can contain:

  1. Simple filter;
  2. A filter tree that contains simple filters with conditions.

A simple filter is an object that contains the required primitives:

The filter tree contains a special primitive "filters", which can contain both simple filters and a filter tree.

Possible filtering errors

Example JSON structure of a simple filter

We get a list of records for which the "name" field has the name "Bob"

("jsonrpc": "2.0", "id": 1, "method": "get.entity", "params" :( "filter" :( "field": "name", "operator": "=" , "value": "Bob")))

Example JSON structure of a filter tree with one nesting level

We get a list of records in which the "name" field has the name "Bob" and its age is 25 years

("jsonrpc": "2.0", "id": 1, "method": "get.entity", "params" :( "filter" :( "filters": [("field": "name", " operator ":" = "," value ":" Bob "), (" field ":" age "," operator ":" = "," value ": 25)]," condition ":" and ")) )

Example JSON structure of a double-nested filter tree

We get a list of records in which the "name" field has the name "Bob" and his age is 25 years old or a list of records in which the "name" field has the name "Dexter" and his age is 2 years

("jsonrpc": "2.0", "id": 1, "method": "get.entity", "params" :( "filter" :( "filters": [("filters": [("field" : "name", "operator": "=", "value": "Bob"), ("field": "age", "operator": "=", "value": 25)], "condition" : "and"), ("filters": [("field": "name", "operator": "=", "value": "Dexter"), ("field": "age", "operator" : "=", "value": 2)], "condition": "and")], "condition": "or")))

Example JSON structure of a filter tree with triple nesting level

Query condition ((addv_comp_id = 10 or addv_comp_id = 12) and (tag_id = 1 or tag_id = 5)) or visitor_id = 14 or (date_from = 2015-12-14 and date_till = 2015-12-16)

("filter" :( "filters": [("filters": [("filters": [("field": "addv_comp_id", "operator": "=", "value": 10), ("field ":" addv_comp_id "," operator ":" = "," value ": 12)]," condition ":" or "), (" filters ": [(" field ":" tag_id "," operator ": "=", "value": 1), ("field": "tag_id", "operator": "=", "value": 5)], "condition": "or")], "condition": "and"), ("field": "visitor_id", "value": 14, "operator": "="), ("filters": [("field": "date_from", "value": "2015 -12-14 12:00:00 "," operator ":" = "), (" field ":" date_till "," value ":" 2015-12-16 15:00:00 "," operator ": "=")], "condition": "and")], "condition": "or"))

Filtering operators

Filtering null and not null will be = null,! = Null

Operator Description Case-sensitive strings Data type
= Equals Yes
!= Not equal Yes number, string, null, boolean, iso8601, enum
< Less than - number, iso8601
> More than - number, iso8601
<= Less than or equal to - number, iso8601
>= More or equal - number, iso8601
like Starts With, Ends With, Contains Yes string
regexp Posix Yes string
jsquery PostgreSQL jsquery Yes object, array
in Array of values ​​in relation to "or" Yes number, string, enum

Sorting data

Data sorting is applied only to the verb "get" (see section) using an array of sorting objects with the following primitives:

  • field - the field by which sorting is performed;
  • order - sorting directions. Possible values ​​are "asc" / "desc". "asc" - ascending, "desc" - descending. The parameter is optional. The default is "asc".

The list of fields by which sorting can be performed is determined individually for each method.

Possible sorting errors

JSON structure:

("jsonrpc": "2.0", "id": "number", "method": "string", "params" :( "sort": [("field": "string", "order": "string ")]))

Paged output

Paging can be applied to the verb "get" (see section). The following parameters are used to perform data pagination:

JSON structure:

("jsonrpc": "2.0", "id": "number", "method": "string", "params" :( "offset": "number", "limit": "number"))

Meta parameters

Returned when using the "get" verb (see section).

Present in both error and successful responses

The "api_version" parameter is returned only for deprecated versions.

JSON structure:

("metadata" :( "api_version" :( "current_version_deprecated": "boolean", "current_version": "string", "latest_version": "string"), "limits" :( "day_limit": "number", " day_remaining ":" number "," day_reset ":" number "," minute_limit ":" number "," minute_remaining ":" number "," minute_reset ":" number ")," total_items ":" number "))

Returned data presentation

Separate list of returned columns

The "get" data-receiving verb (see section) can contain a special optional primitive "fields" of the array type, which can contain a list of fields to be shown in the output. If the "fields" primitive is not used, then the output shows all default fields for the called method.

The list of fields is individual for each method.

JSON structure:

("jsonrpc": "2.0", "id": "number", "method": "string", "params" :( "fields": ["string"]))

Possible errors in the presentation of returned data

Common fields for all methods

Name Type of Mandatory Valid values Description
id string or number Yes A unique identifier for the API request that is used to associate a request with a response. It is recommended to do it in the form of a unique hash or a random number.
method string Yes Called method
jsonrpc string Yes 2.0 JSON-RPC specification number
params object Yes Contains the body of the API request. Depending on the method being called, the request body changes.

Authentication

entrance

Request parameters

Response options

The lifetime of the received authentication session key after calling the "login.user" method is 1 hour. When the session key expires, it must be re-requested, i.e. call the "login.user" method.

To make API requests, it is possible to use a permanent authentication key, which is available in the Personal Account at the user level.

JSON request structure

("jsonrpc": "2.0", "id": "number", "method": "login.user", "params" :( "login": "string", "password": "string"))

I am using InApp V3 code for in-app purchases in my app, I get this BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE error and error value: 3 when google account is not available on device. I want to know if there are other possibilities for getting this error because when I get this error I need to show a popup to the user with some data. If this is due to the inaccessibility of the Google account on the device, I will show a dialog with the appropriate text. This is the code I am using

MHelper.startSetup (new IabHelper.OnIabSetupFinishedListener () (public void onIabSetupFinished (IabResult result) (if (! Result.isSuccess ()) (// error here return;))));

This error is Error checking for billing v3 support. (response: 3: Billing Unavailable) Error checking for billing v3 support. (response: 3: Billing Unavailable)

As we can see directly in the IabHElper setup code of the sample provided by google, the error means:

"The billing service is not available on the device."

Billing API version is not supported for the type requested

This is In-app Billing Reference (IAB Version 3), so the error means IAB v3 is not installed on the device.

This effectively means that the user has a google account and possibly also an in-app billing service, but it doesn't have the latest version. This happens in older devices, and when the user never updates anything, it is used for devices where you can see the old Market app instead of the Play app.

So the error you have to show to the user and the test you have to do is not if the device has a google account, but if it has google play services installed and correctly updated.

UPDATE:

If you are looking for code all over the SDK libraries and helper classes provided by google, this is the only place where we can find exactly what you are calling: IabHelper of the IabHelper class

Intent serviceIntent = new Intent ("com.android.vending.billing.InAppBillingService.BIND"); if (! mContext.getPackageManager (). queryIntentServices (serviceIntent, 0) .isEmpty ()) (// service available to handle that Intent mContext.bindService (serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);) else (// no service available to handle that Intent mServiceConn = null; if (listener! = null) (listener.onIabSetupFinished (new IabResult (BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, "Billing service unavailable on device."));))

This means that the application cannot connect to the service on the device, since the package manager doesn't even know about it . This is the only option that can cause this error. And what does it mean that it cannot connect to the service? This means one of the following:

  • The device does not have a service installed.
  • It has an old version as we know the latest versions of the play store are using IAB v3.

So your error can only mean one of these, which means to you that you have to show the mesagge user, for example: "You don't have google play services installed, or you need to update them." And there is no other possibility or getting this error.

But, if you want to make it easier for users, you can tell them that they need to update the Google Play app to the latest version. And it will make everything work like a charm.

This error is also accepted after the user deletes their google account from the device.

Basically the possibility of your BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE problem is that in some countries it is still not allowed in App Purchase like in Serbia and in many countries.

Thus, any user from a country where Google Play does not support the App Purchase will receive BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE.

This will be less likely that the user will not have the Google Play Service installed on the phone updated, so don't worry about that case.

Try these hacks

Delete the cache, data and updates for the replay app, launch the replay app again, it should work! Or try with latest updates (if fixed)

FYI:

Just keep in mind:

    IABv3 is built into Google Play Services, so an update is required to update App Play.

    V2 has been built into the Play Store client. The cache / EULA issue is not specifically related to the IAB, it has to do with the Play Services setting (and hopefully for most users this is optional, part of the cache anyway).

    During this transition period, when Play Services needs to be updated, the system needs to be updated in order for the application to use it, but I think most people would agree that this is better than waiting for an OS update. "

See this report: bug report, G + message

If you haven't authenticated your device with your Google account, you might get this error.

For those still facing this issue, in most cases iab is not supported in your country as Williams said. You can use a VPN for it to work.

If a regular PBX is no longer cool for you, then the word INTEGRATION appears in the lexicon. For many, this word is associated with complex processes, long development and high budgets. The INTEGRATION is usually followed by the API, the very set of procedures and means by which our IP PBX is connected to some third-party application.


The meaning of INTEGRATION almost always boils down to transferring from the IP PBX to the application (usually some kind of CRM) of the number when an outgoing call (well, the fact of the call itself, of course) and transferring the same number from the application to the IP PBX when outgoing. Further, the application itself decides what to do with this number:

  • Open card found by number
  • Make an entry in the log
  • send a message
  • Etc.

Less often, INTEGRATION implies the embedding of broader functionality:

  • Operator Line State Management
  • Working with your own calls
  • Dealing with colleagues' calls
  • Working with conferences
  • Working with the phone book
  • Etc.

Here, in fact, we are transferring our CRM softphone functionality.

What are the 3CX APIs

HTTP API

With its help you can:

  • Make a call from a 3CX subscriber (to an internal or external number)
  • Disconnect subscriber
  • Enable subscriber
  • Disable subscriber external calls
  • Enable external calls to the subscriber
  • Enable conversation recording for the subscriber
  • Disable call recording for the subscriber

It all works quite simply, for example, in order to make a call, we type the following line in the browser
IP-ADDRESS -3CX: 5000 / ivr / PbxAPI.aspx? Func = make_call & from = number-calling-from & to = calling-where & pin = password

First, the call will arrive to the initiator, put it on hold, then 3CX will dial up to the remote number and combine the calls.

Full description of variables is here- http://www.3cx.com/blog/docs/3cx-http-api/
You can use it in any browser-based CRM. Cons - interaction only towards the automatic telephone exchange. It is impossible to send a notification to the client about an incoming call in this way.

CRM API

With its help you can:

  • Make calls from a third party application
  • Call status change notifications (connection established, disconnected, dialing, dialing, etc.)
  • Subscriber status notifications (logged in, logged out, no connection to PBX)

CRM API is essentially a module for the native softphone - 3CX Phone for Windows. To develop a plug-in, you need to be proficient in Microsoft Visual Studio. A DLL library is made, which is written in the configuration file of the softphone.

You can use it anywhere. It should be remembered that this API requires a softphone, which is both a plus: it takes over the client - server interaction, and a minus - a softphone is needed anyway.

CALL CONTROL API

The Call Control API is available for 3CX Phone System version 11 and higher and allows you to programmatically control calls. Development requires experience with .NET and C #.


With its help you can:
  • View all active calls on PBX
  • Call control interception
  • Call transfer
  • Hang up
  • Changing 3CX Phone System Settings
  • And about 30 more different functions
The use of this API assumes application in large projects. The main difference from other APIs is that the interaction goes directly with the PBX (with the server side), and not with the client.
Description of commands with examples is here - http://www.3cx.com/blog/docs/call-control-api/

CRM integrations available "out of the box"

All out-of-the-box integrations are made as plugins for 3CX Phone.
  • Click to Call - the ability to dial a number with one click from the CRM.
  • Call Pop-up - automatic display of a contact card based on caller ID.
  • Call Journals - keeping call history in CRM.
Actions on the CRM side are configured in 3CXPhone.
Integration with Microsoft Outlook and Microsoft Office 365 is available for any commercial release of 3CX Phone System commercial license. Other plugins require CRM 3CX Phone System PRO version. It should be noted that the number of users of these plugins is not licensed in any way.

In addition to the already mentioned Outlook and Office, the following CRMs are supported:

  • Microsoft Dynamics
  • Google Contacts
  • Salesforce
  • SugarCRM
  • Sage CRM
Each plugin is installed from a general distribution kit and has 2 parts, the first is 3CXPlugin for the mobile phone and the second is a customization package for the CRM system and a small manual on how to install it, so that the necessary button appears in the interface - CALL.

In the second part of the article, I will provide a selection of third-party plugins and modules implemented on the 3CX API.