frank1 has asked for the wisdom of the Perl Monks concerning the following question:
My Try:curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:<SEND_MAIL_TOKEN>" \ -d '{ "bounce_address":"<BOUNCE_ADDRESS>", "from": {"address": "noreply@<DOMAIN>"}, "to": [{"email_address": {"address": "user@domain.com","name": + "John Deo"}}], "subject":"Test Email", "htmlbody":"<div><b> Test email sent successfully. </b></div>" +}'
Am getting this Response( ERROR):#!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; use JSON; use Data::Dumper; print "Content-type: text/html\n\n"; my $url = "https://api.zeptomail.com/v1.1/email"; my $json = encode_json { bounce_address => 'bounce@email', from => 'noreply@email.com', to => 'receipt@email.com', subject => 'Test Email', htmlbody => '<div><b> Test email sent successfully. </b></div>', }; my $http = HTTP::Tiny->new( default_headers => { Authorization => 'Token', } ); my $response = $http->post( $url => { content => $json, headers => { 'Content-Type' => 'application/json' }, }); if ( $response->{'is_success'} ) { print Dumper( decode_json $response->{'content'} ); } else { print "$response->{'content'} $response->{'reason'}\n"; }
{"error":{"code":"TM_3501","details":[{"code":"GE_122","message":"Inva +lid value found","target":"from"}],"message":"Unprocessable Entity"," +request_id":"2d6f.1281848db93b53d5.m1.659b6560-d7c7-11ed-90d9-525400d +4bb1c.1876c4546b6"}}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem parsing json
by NERDVANA (Priest) on Apr 11, 2023 at 09:05 UTC | |
by frank1 (Monk) on Apr 11, 2023 at 11:13 UTC | |
by NERDVANA (Priest) on Apr 11, 2023 at 18:00 UTC | |
|
Re: Problem parsing json
by Corion (Patriarch) on Apr 11, 2023 at 06:11 UTC | |
|
Re: Problem parsing json
by soonix (Chancellor) on Apr 11, 2023 at 10:58 UTC | |
|
Re: Problem parsing json
by LanX (Saint) on Apr 10, 2023 at 18:58 UTC |