menu di navigazione del network

Perl - Come "passo" l'API KEY


Sto provando a scrivere del codice per IO e ho letto la documentazione:

Sto provando in perl come segue:

#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use JSON;
use Digest::MD5 qw(md5);
use Digest::SHA qw(hmac_sha256_base64);
use MIME::Base64;

my $api_key ='aaaaa';
my $api_private_key ='aaaaa';
my $ua = LWP::UserAgent->new;

my $url = "";

my %req = (

        time_to_live => 3600,
        content => {
                subject => "Welcome new user !",
                markdown => "# This is a markdown header to show how easily markdown can be converted to **HTML** Remember: this has to be a long text.",
                payment_data => {},
                due_date => "2019-10-13T00:00:00.000Z"
        default_addresses => {
                email => "andrea\"

my $nonce = int(rand(1000000));
my $post_data = encode_json(\%req);
my $post_data_enc = encode_base64(md5($post_data));
my $req_signature = sprintf("%sPOST%s%s%s", $api_key, lc(urlencode($url)), $nonce, $post_data_enc);

my $req_signature_hmac = hmac_sha256_base64($req_signature, decode_base64($api_private_key));
my $auth_header_value = sprintf("amx %s:%s:%s", $api_key, $req_signature_hmac, $nonce);
my $response = $ua->post($url,
    Content => $post_data,
    'Content-Type' => 'application/json',
    'charset' => 'utf-8',
    Authorization => $auth_header_value

Ma dove devo passare l’api key e la subscription key?

Continua a rispondermi:
Request failed: { "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }

Come posso fare?



L’api key andava messa nell’header e non nel context.

Se qualcuno avesse bisogno del codice basta chiedere che lo scambio volentieri.