Difference between revisions of "MOR API hash construction"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 47: Line 47:
* email
* email
* mtype
* mtype
* monitoring_id
* 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


<br><br>
<br><br>

Revision as of 13:13, 22 December 2011

How to construct hash to authenticate data over API






  • Concatenate all values you want to send into a single string. Notice that order 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.



Allowed params

  • user_id
  • period_start
  • period_end
  • direction
  • calltype
  • device
  • balance
  • users
  • block
  • email
  • mtype
  • monitoring_id
  • 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



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.



See also