Tariscope 4.6.Tariscope API guide
Content
How to work with Tariscope API?
Example of using Tariscope API
7. accounts.summary
11. tariffs.plans
12. tariffs.details
13. tariffs.time
14. services.list
16. tariscope.database
17. tariscope.build
18. tariscope.serial
19. tariscope.edition
20. tariscope.summary
21. sql
Tariscope 4.6.Tariscope API guide
Introduction
Tariscope API is a special interface of the Tariscope 4.6 system that allows you to retrieve and modify some data from the Tariscope database by executing HTTP requests.
The Tariscope API is intended for software developers who want to integrate their software with the Tariscope system.
The Tariscope API can be used by users of both the Provider and Enterprise editions, but due to the fact that not all features of the Provider edition are available in the Enterprise version, not all API methods may be useful to Tariscope Enterprise users.
What data can be received (sent) from (to) Tariscope using the Tariscope API?
- Subscriber parameters. [subscriber.get]
- List of subscribers of any group. [subscriber.list.department]
- List of subscribers of the communication node. [subscriber.list.node]
- Update subscriber parameters. [subscriber.update]
- Create a new subscriber. [subscriber.create]
- Add a telephone number to the subscriber. [subscriber.dnadd]
- Summary information on the subscriber's account for a specific period.[accounts.summary]
- Cancel all charges for a specific subscriber for the indicated period. [accounts.charges]
- Enter information into the Tariscope database to pay the subscriber for the call service. [accounts.payment]
- Retrieve information from the Tariscope database before paying for a specific subscriber for a task period.[accounts.payments]
- Cancel all active tariff plans. [tariffs.plans]
- Select parameters for all or other tariffs. [tariffs.details]
- Select the parameters of a specific tariff depending on the hour. [tariffs.time]
- Eliminate the overflow of active services. [services.list]
- The current version of Tariscope. [tariscope.version]
- The current version of the Tariscope database. [tariscope.database]
- Date of the current version of the Tariscope system. [tariscope.build]
- Serial number of license for Tariscope.[tariscope.serial]
- The Tariscope system edition. [tariscope.edition]
- Get general information about the Tariscope system. [tariscope.summary]
- Any system data contained in the database can be retrieved, changed, or added using SQL commands. [sql]
Tariscope 4.6.Tariscope API guide
Example of using Tariscope API
Before executing any API requests to Tariscope, you must first obtain a token, which will be used to authorize in Tariscope when executing API methods.
Obtaining a token is performed using the api.auth method. The token is valid for 6 hours. After that, you must obtain a new token.
An example of executing a request to Tariscope using the Tariscope API will be demonstrated using the Postman program.
Getting a token
To execute any API methods, you must be authorized in the system. To do this, execute the /api/auth method.
Select the Post method and enter a request to connect to the computer where Tariscope is installed (Figure 1).
Figure 1
Example query:
http://localhost:7000/api/auth
localhost is used only when the application making the API request is on the same server as the Tariscope software. Otherwise, use the IP address of the Tariscope server.
7000 in this example is the IP port that Tariscope is running on. By default, when installing Tariscope, the suggested IP port is 8085.
/api/auth is a method for authorization in the system.
Before sending a request in the (Body)of the request, you should select row, set the JSON format and enter the API user name (username) and his password (password) in this format.
After that, click on the Send button. If all the parameters are set correctly, you will receive a response in JSON format, from where you should copy the token (Figure 2). You should copy only the value of the “token” parameter.
Figure 2
To perform all other Tariscope API methods, this token must be inserted into the Authorization tab in the Token position.
Tariscope 4.6.Tariscope API guide
How to work with Tariscope API?
First, you need to create a user in the Tariscope system to work with the API and grant him access to the API methods that he is allowed to use.
To do this, in the Tariscope menu, select Additional options -> Integration. A page will appear, an example of which is shown in Figure 1.
Figure 1
Click on the Tariscope API button. A page will be displayed, an example of which is shown in Figure 2.
Figure 2
This page has two links: API Users and More Methods.
API Users
A tab opens that allows you to create, edit, or delete a Tariscope API user, grant them access to specific API methods, and reset their password. An example of this page is shown in Figure 3.
Figure 3
To create a new user, click the Add icon. The window shown in Figure 4 will appear.
Figure 4
In the Username field, enter a name.
If necessary, you can add any comment in the Description field. This is an optional field to enter.
In the New Password and Confirm Password fields, enter the password that this user will use to connect to the Tariscope system.
Click the Save button.
To select the API methods that the user will have access to, select the user in the users table (Figure 3), and click the Method Rights icon on the toolbar. The Rights Settings page will appear, an example of which is shown in Figure 5.
Figure 5
Use the radio buttons to select the API methods the user will have access to. Click the Save button.
This completes the setup of access to API methods from the Tariscope system.
Next, you must write code to execute API methods. To access the API, you must authenticate using JSON Web Tokens (JWT). To do this, you must pass the username and password in the body of the auth method request. If the authorization is successful, Tariscope will return a token that is tied to the IP address from which the request was made. This token is valid for 6 hours.
When making API requests, JSON or XML formats are supported. JSON format is used by default. To specify a specific format, you must specify it in the request.
Example, for a POST request: /api/auth/xml
Example for a GET request: /api/subscriber/get/xml/?id=1234
The More Methods link (Figure 2) displays a window asking you to suggest new methods that we can implement over time.
Tariscope 4.6.Tariscope API guide
Tariscope API Methods
1. subscriber.get
This is the GET method used to retrieve subscriber parameters.
Query parameters:
- id – subscriber identifier in Tariscope.
- email – subscriber’s email address, which is specified in Tariscope.
To execute the method, one of these parameters is sufficient.
Data returned by the method:
- id – subscriber identifier.
- fullname – full name of the subscriber.
- street – street.
- House – house number.
- Flat – apartment number.
- email – email address.
- description – description.
- authcode – authorization code.
- ispublic – an indication of whether the subscriber is displayed in the subscriber directory.
- abonenttype – subscriber type.
- code – EDRPOU code.
- zipcode –postal code.
- personalcode – personal code.
- contractid – subscriber contract identifier.
- information – additional information about the subscriber.
- privilegeinfo – information about privileges.
- area – district.
- contractdate - contract date.
- building – building number.
- floornumber – floor number.
- accountId – subscriber account identifier.
- gender –gender of the subscriber (for individuals)..
- birthday – date of birth.
- bankaccount – date of birth.
- bankmfo – bank code.
- taxcode – tax number.
- deliverytype – type of delivery of correspondence.
- privilegediscount – discount.
Example of a request to get subscriber parameters with ID = 2928:
http://localhost:8085/api/subscriber/get/?id=2928