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

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');

Replies are listed 'Best First'.
Re^7: alibaba cloud sms api
by poj (Abbot) on Sep 02, 2019 at 17:50 UTC

    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