Zadarma authorisation

Hello,

I am trying to find a way to use zadarma api.

The problem is with the authorisatio because it need to be generated a key:

Each authorization request should be sent with an additional header:

“Authorization: user_key: signature”

Authorization keys must be generated in your personal account.

The signature is made according to the following algorithm:

  • The array of transmitted data (GET, POST, PUT, DELETE) is sorted by the key name in alphabetical order;
  • The received array forms the query strip (for example, http_build_query function in PHP), example “from=DATEFROM&to=DATETO…”;
  • It is then concatenated as follows: line = method_name request_line md5(request_line), where “method_name” is the request line after the domain (with indication of API version) till the beginning of the parameters list, for example - ‘/v1/sip’
  • The resulting string is hashed by the algorithm sha1 with the secret user key: hash = hash( string, secret_key )
  • And then the hash is encrypted in base64 signature = base64_encode( hash )

So with http request node I thinik that is possible to achieve authorisation sending header (and not using credential).

The problem is how to generate the signature key?

I am trying to use node crypto but I doubt if it’s compatible to generate the value as it is described above.

Maybe is possible to use a function and with this generate the value?

Unfortunately I don’t know program lanuages and zadarma api have instructions for python, c , php

Thanks for any help/

Hey @georgew,

In theory the below might do the job, The function node I think does what they are asking for.

Hey @georgew !
Did you manage to set up the process via the Zadarma API? Have you tested @Jon suggested workflow example?