Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: alibaba cloud sms api

by holli (Abbot)
on Sep 02, 2019 at 16:03 UTC ( [id://11105451]=note: print w/replies, xml ) Need Help??


in reply to Re^4: alibaba cloud sms api
in thread alibaba cloud sms api

InvalidVersionSpecified parameter Version is not valid is quite clearly telling you what's wrong. Or at least where to look. When in doubt, read the code. Your must send the version as part of the query, it's not supposed to be sent as a header.


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^6: alibaba cloud sms api
by bigup401 (Pilgrim) on Sep 02, 2019 at 16:35 UTC

    thanks for clear response

    but i made changes and send the version through query and removed it from header, but am still getting same error

    my $url = "https://dysmsapi.aliyuncs.com"; my $params = [ RegionId => '1', PhoneNumbers => '4324234', SignName => + 'fghgfhg', TemplateCode => 'fghgfh', api_version => '2018-04-08' ]; my $uri = URI->new(); $uri->query_form(@$params); $urlparam = $uri->as_string; my $req = HTTP::Request->new(POST=>$url); $req->header('Content-Type' => 'application/json; charset=UTF-8'); $req->header('access_key_id' => 'sdsadasd'); $req->header('access_key_secret' => 'asdasdsa');

      If it's any help, the Ruby code posted the following parameters

      AccessKeyId => <accessKeyId>
      Action => SendSms
      Format => JSON
      PhoneNumbers => 7766
      RegionId => default
      SignName => iiuy
      SignatureMethod => HMAC-SHA1
      SignatureNonce => 7e44843695e9a68247e15d3beb018b63
      SignatureVersion => 1.0
      TemplateCode => jkk
      Timestamp => 2019-09-02T16:28:32Z
      Version => 2017-05-25
      Signature => TquzjlguNxK2WdUVVrfm4yYTHZI=
      

      code snippet from rpc_client.rb

      def default_params default_params = { 'Format' => 'JSON', 'SignatureMethod' => 'HMAC-SHA1', 'SignatureNonce' => SecureRandom.hex(16), 'SignatureVersion' => '1.0', 'Timestamp' => Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S +Z'), 'AccessKeyId' => self.access_key_id, 'Version' => self.api_version, } default_params.merge!('SecurityToken' => self.security_token) if + self.security_token

      Also this looks wrong

      $req->header('Content-Type' => 'application/json; charset=UTF-8');

      The content-type in the header was

      application/x-www-form-urlencoded
      poj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105451]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found