M4 API user details update
From Kolmisoft Wiki
Jump to navigationJump to search
Description
API updates User's details
API can be used by:
- Admin
- Manager with appropriate permissions. If the Show only assigned Users option is enabled, then the Manger can update details only for assigned Users.
Usage
- M4 call: /api/user_details_update
- Methods: POST, GET(if allowed, not recomended)
Parameters
Parameters that are included in the hash
- u - username to login. Required.
- user_id - ID of the user whose details will be updated. Required.
- hash – SHA1 hash constructed using API Secret Key ( More described in Constructing hash). Required.
Parameters which are not included into hash. All parameters are optional:
General:
- currency_id - id of the currency in M4 DB (this is an internal number, NOT an abbreviation). You can check the id in Maintenance -> Settings -> Currencies
- call_limit - set Call Limit
- hidden - set Hidden option (1 - option set, 0 - option unset)
- responsible_manager_id - id of the responsible manager
- hide_non_answered_calls - sets Hide Non-Answered calls: option (1 - option set, 0 - option unset)
Blocking:
- blocked - set Blocked option (1 - Blocked, 2 - Not Blocked)
- by - block at date year
- bm - block at date month (1-12)
- bd - block on date day (1-31)
- block_conditional_use - set Block at (conditional): option (1 - option set, 0 - option unset)
Details:
- vat_number - TAX Registration Number
- language - Language
- clientid - Company/Personal ID
- first_name - First Name/Company Name
- last_name - Last Name
- accounting_number - Accounting Number
- agreement_number - Agreement Number
- ay - the year of Agreement Date
- am - the month of Agreement Date (1-12)
- ad - the day of Agreement Date (1-31)
- taxation_country - id (a number) of Country of Taxation. The ID of the country can be found in Maintenance -> Directions (it will be a number at the end of URL when clicking on Edit for a specific country)
Address:
- address - Address
- city - City
- postcode - Postcode/ZIP
- county - County
- mob_phone - Mobile Phone
- fax - Fax
- direction_id - Country. The ID of the country can be found in Maintenance -> Directions (it will be a number at the end of URL when clicking on Edit for a specific country)
- phone - Phone
- state - State
- email - Main Email
Warning balance:
- warning_email_active - sets Warning Balance Active option (1 - Active, 0 - Not Active)
- warning_email_balance - Warning Balance for he User
- warning_email_hour - send Warning Balance email at x hour. [1-23 - an hour to send Warning Balance, -1 - option disabled]
Taxes:
- tax1_name - the name of the 1st Tax field
- tax1_value - tax value (in float format) of the 1st Tax field
- tax2_name - the name of the 2nd Tax field
- tax2_value - tax value (in float format) of the 2nd Tax field
- tax2_enabled - enable/disable the 2nd tax field. [0 - disabled, 1- enabled]
- tax3_name - the name of the 3rd Tax field
- tax3_value - tax value (in float format) of the 3rd Tax field
- tax3_enabled - enable/disable the 3rd tax field. [0 - disabled, 1- enabled]
- tax4_name - the name of the 4th Tax field
- tax4_value - tax value (in float format) of the 4th Tax field
- tax4_enabled - enable/disable the 4th tax field. [0 - disabled, 1- enabled]
Invoices:
- generate_invoice - sets Generate Invoices automatically option. (1 - option set, 0 - option unset)
Blacklist / Whitelist:
- enable_static_source_list - option to enable/disable Static Source Blacklist/Whitelist. Available values - ["no" - No, "blacklist" - Blacklist, "whitelist" - Whitelist]
- static_source_list_id - id of the Number Pool for Static Source (it will be set to whitelist/blacklist depending on enable_static_source_list value).
- enable_static_list - option to enable/disable Static Source Blacklist/Whitelist. Available values - ["no" - No, "blacklist" - Blacklist, "whitelist" - Whitelist]
- static_list_id - id of the Number Pool for Static Destination (it will be set to whitelist/blacklist depending on enable_static_list value).
Comment:
- comment - Comment.
Request
If API Secret Key = secret
You send:
HTML POST: http://<SERVER_IP>/billing/api/user_details_update?u=admin&user_id=3&hidden=1&hash=80ea571b1932bfecb937013966849154cb995e05
Returns
<?xml version="1.0" encoding="UTF-8"?> <page>
<status> <success>User was updated successfully</success> </status>
</page>
Errors:
- <error>API Requests are disabled</error> – Allow API globally setting is unchecked
- <error>GET Requests are disabled</error> – Allow GET API setting is unchecked
- <error>Access Denied</error> – The user is not allowed to get User details or the username and password are not correct.
- <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and the order of parameters while concatenating the hash_string
- <error>You are not authorized to view this page</error> – User is not authorized to get users list.
- <error>User was not found</error> – User was not found.
- <error>User was not found</error> - User was not found using user_id. Use correct user id.
- <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
- <error>Access Denied</error> - Check params and permissions.
- <error>You are not authorized to view this page</error> - Manager dont have permission.
- <error>User was not updated</error>
- <error>Manager is invalid</error> Responsible manager id was not correct
- <message>problem message</message>
Example:
<status> <error>API Requests are disabled</error> </status>