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"}}
In reply to Problem parsing json by frank1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |