MOR API hash construction
From Kolmisoft Wiki
General
How to construct hash to authenticate data over API
- Concatenate all values you want to send into a single string. Notice that order when constructing hash should be as params are listed in descriptions.
For example. You want to get all answered calls of user 123 from 2009-09-09 00:03 till now. You must send user_id, period_start and calltype params.
>> time = "2009-09-09 00:03".to_time.to_i
=> "1252454580"
>> hash_string = "123" + time.to_s + "answered"
=> "1231252454580answered"
- Add API_Secret_Key to the end of hash_string
>> API_Secret_Key = "Very Sercet Key"
>> hash_string += API_Secret_Key
=> "1231252454580answeredVery Sercet Key"
- Calculate SHA1 hash of hash_string
>> Digest::SHA1.hexdigest(hash_string)
=> "b93c35d5c6183288322122561a3da7e09abb63b7"
- Use this hash as a hash parameter in API calls.
All allowed params
- user_id
- period_start
- period_end
- direction
- calltype
- device
- balance
- monitoring_id
- users
- block
- mtype
- tariff_id
- u0
- u1
- u2
- u3
- u4
- u5
- u6
- u7
- u8
- u9
- u10
- u11
- u12
- u13
- u14
- u15
- u16
- u17
- u18
- u19
- u20
- u21
- u22
- u23
- u24
- u25
- u26
- u27
- u28
- ay
- am
- ad
- by
- bm
- bd
- pswd
- user_warning_email_hour
- pgui
- pcsv
- ppdf
- recording_forced_enabled
- i4
- tax4_enabled
- tax2_enabled
- accountant_type_invalid
- block_at_conditional
- tax3_enabled
- accountant_type
- tax1_value
- show_zero_calls
- warning_email_active
- compound_tax
- tax4_name
- allow_loss_calls
- tax3_name
- tax2_name
- credit
- tax1_name
- total_tax_name
- tax2_value
- tax4_value
- ignore_global_monitorings
- i1
- tax3_value
- cyberplat_active
- i2
- i3
- recording_enabled
- email_warning_sent_test
- own_providers
- a0
- a1
- a2
- a3
- a4
- a5
- a6
- a7
- a8
- a9
- s_user
- s_call_type
- s_device
- s_provider
- s_hgc
- s_did
- s_destination
- order_by
- order_desc
- only_did
- description
- pin
- type
- devicegroup_id
- phonebook_id
- number
- name
- speeddial
- s_user_id
- s_from
- s_till
- s_transaction
- s_completed
- s_username
- s_first_name
- s_last_name
- s_paymenttype
- s_amount_max
- s_currency
- s_number
- s_pin
- p_currency
- paymenttype
- tax_in_amount
- amount
- transaction
- payer_email
- fee
- id
- quantity
- callerid
- cardgroup_id
- status
- date_from
- date_till
- s_reseller_did
- s_did_pattern
- lcr_id
- dst
- src
- message
- server_ip
- device_type
- device_username
- device_password
- login_url
- login_username
- username
- first_name
- last_name
- full_name
- nice_balance
- warning_email_balance
- nice_warning_email_balance
- currency
- user_email
- company_email
- company
- primary_device_pin
- login_password
- user_ip
- date
- auth_code
- transaction_id
- customer_name
- company_name
- url
- trans_id
- cc_purchase_details
- monitoring_amount
- monitoring_block
- monitoring_users
- monitoring_type
- payment_amount
- payment_payer_first_name
- payment_payer_last_name
- payment_payer_email
- payment_seller_email
- payment_receiver_email
- payment_date
- payment_free
- payment_currency
- payment_type
- payment_fee
- call_list
- email_name
- email_to_user_id
- caller_id
- device_id
Examples
Example of User Update Api hash string:
581asdfghjkl
- 581 - is user ID
- asdfghjkl - is API key
Such string should be used to generate SHA1 hash.
Hash check
This functionality is only available for administrator. Go to SETTINGS -> Setup -> Generate hash. Let's assume that API secret key is set to MORMOR. Enter uri and click Generate:
As it is written by the information icon, parameters are shown in the same order as they were when generating hash.