Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

  • Ben June 2019
How to get plain text response from subscribe API
  • Vote Up0Vote Down macksmacks
    Posts: 0Sendy user

    Hi,

    I'm using the Sendy API (Sendy Version 3.1.1) from node.js with axios. The code looks like this:

    const response = await axios.post(
        "xxx",
        querystring.stringify({
            list: "xxx",
            email,
            gdpr: true
        }),
        { headers: { "Content-Type": "application/x-www-form-urlencoded" } }
    );
    

    If I check response.data, the response I get is always in HTML format (not plain text). For example:

    <!DOCTYPE html>
    <html>
            <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    <meta name="viewport" content="width=device-width, initial-scale=1">
                    <link rel="Shortcut Icon" type="image/ico" href="xxx">
                    <title>Thank you, a confirmation email has been sent to you.</title>
            </head>
            <style type="text/css">
                    body{
                            background: #ffffff;
                            font-family: Helvetica, Arial;
                    }
                    #wrapper
                    {
                            background: #f9f9f9;
    
                            width: 300px;
                            height: 70px;
    
                            margin: -140px 0 0 -150px;
                            position: absolute;
                            top: 50%;
                            left: 50%;
                            -webkit-border-radius: 5px;
                            -moz-border-radius: 5px;
                            border-radius: 5px;
                    }
                    p{
                            text-align: center;
                    }
                    h2{
                            font-weight: normal;
                            text-align: center;
                    }
                    a{
                            color: #000;
                    }
                    a:hover{
                            text-decoration: none;
                    }
                    #top-pattern{
                            margin-top: -8px;
                            height: 8px;
                            background: url("xxx") repeat-x 0 0;
                            background-size: auto 8px;
                    }
            </style>
            <body>
                    <div id="top-pattern"></div>
                    <div id="wrapper">
                            <h2><span style="font-size: 20px;padding:10px;float:left;margin-top:-18px;">Thank you, a confirmation email has been sent to you.</span></h2>
                    </div>
            </body>
    </html>
    

    Is there any way I can get a plaintext response so that I can easily check the error messages?

    Thanks for your help!

    Best,
    Max

  • 1 Comment
  • Vote Up0Vote Down BenBen
    Posts: 3,606Sendy support

    Hi,

    Pass boolean = true into the subscribe API call.

    From the API doc:

    Thanks.

    Best regards,
    Ben

This discussion has been closed.
All Discussions