Manage vendors
These methods manage vendors, the carriers you terminate calls to, the same as the Vendors screen of the panel. The gateways of a vendor are its connections. To change a vendor’s balance, use the methods in Change a vendor’s balance.
All methods support trusted mode with i_customer.
Vendor structure
Section titled “Vendor structure”createVendor and updateVendor take these fields, and getVendorInfo and listVendors return them together with i_vendor. Required applies to createVendor.
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Vendor Name |
web_login |
string | yes | Web Login of the vendor’s portal |
web_password |
string | yes | Web Password of the vendor’s portal |
i_time_zone |
int | yes | Time Zone of the vendor’s portal and reports. See Time zones |
base_currency |
string | no | Base Currency, ISO 4217, for example USD. Fixed after creation |
balance |
double | no | Opening Balance. Fixed after creation; change it with vendorAddFunds, vendorCredit or vendorDebit |
i_lang |
string | no | Language of the portal, a two-letter code such as en |
i_export_type |
int | no | Download Format, from the export_types dictionary |
i_password_policy |
int | no | Password Policy for the web password |
round_up |
boolean | no | Calls Duration: True for Round-Up, False (default) for Round |
cost_round_up |
boolean | no | Calls Cost: True for Round-Up, False (default) for Round |
decimal_precision |
int | no | Cost Decimal Precision: decimals kept for the cost of each call. Default 20 |
company_name, salutation, first_name, mid_init, last_name |
string | no | Company Name, Mr./Ms…, First Name, M.I., Last Name |
street_addr, city, state, postal_code, country |
string | no | Address, City, Province/State, Postal Code, Country/Region |
contact, phone, fax, alt_phone, alt_contact |
string | no | Contact, Phone, Fax, Alt. Phone, Alt. Contact |
email, cc, bcc |
string | no | E-Mail, CC, BCC |
The dictionaries are read with getDictionary.
createVendor
Section titled “createVendor”Creates a vendor. addVendor is another name for the same method.
Parameters
Section titled “Parameters”The fields of the vendor structure.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
i_vendor |
int | ID of the new vendor |
Example
Section titled “Example”call("createVendor", { "name": "Example Carrier", "web_login": "example-carrier", "web_password": "Vx4-mT8-qL2", "i_time_zone": 1, "base_currency": "USD", "email": "noc@carrier.example.com",}){"result": "OK", "i_vendor": 41}updateVendor
Section titled “updateVendor”Changes a vendor. Fields you leave out keep their values. balance and base_currency cannot be changed.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_vendor |
int | yes | ID of the vendor |
| other fields | no | Any field of the vendor structure |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("updateVendor", {"i_vendor": 41, "decimal_precision": 4}){"result": "OK"}deleteVendor
Section titled “deleteVendor”Deletes a vendor together with its connections. Routing group entries that used those connections stop matching.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_vendor |
int | yes | ID of the vendor |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("deleteVendor", {"i_vendor": 41}){"result": "OK"}getVendorInfo
Section titled “getVendorInfo”Returns one vendor by ID or by name.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_vendor |
int | one of | ID of the vendor |
name |
string | one of | Name of the vendor |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
vendor |
struct | i_vendor and the fields of the vendor structure |
Example
Section titled “Example”call("getVendorInfo", {"i_vendor": 41}){ "result": "OK", "vendor": { "i_vendor": 41, "name": "Example Carrier", "web_login": "example-carrier", "base_currency": "USD", "balance": 250.0, "i_time_zone": 1, "round_up": False, "cost_round_up": False, "decimal_precision": 4, # … the other fields },}listVendors
Section titled “listVendors”Returns your vendors. getVendorsList is an older name for the same method, with the same parameters and result.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
name_pattern |
string | no | Filter by name, an SQL ILIKE pattern: case-insensitive, % matches any characters. %carrier% finds every name containing carrier |
limit |
int | no | Return at most this many vendors |
offset |
int | no | Skip this many vendors first |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
vendors |
array | One struct per vendor, with i_vendor and the fields of the vendor structure |
Example
Section titled “Example”call("listVendors", {"name_pattern": "%carrier%", "limit": 50, "offset": 0}){ "result": "OK", "vendors": [ {"i_vendor": 41, "name": "Example Carrier", "web_login": "example-carrier", "balance": 250.0, "base_currency": "USD"}, # … the other fields ],}Related
Section titled “Related”- Vendors: the same fields in the panel
- Manage vendor connections
- Change a vendor’s balance
- Get system dictionaries