标签: newsletter2go

Newsletter2Go REST API - 如何将新收件人添加到列表中?

是否可以通过Newsletter2Go的REST API添加新的收件人?

我试过这个(片段):

public function subscribeAction()
{
    $this->init();

    $email = $this->getRequest()->getParam('email');
    $gender = $this->getRequest()->getParam('gender');
    $first_name = $this->getRequest()->getParam('first_name');
    $last_name = $this->getRequest()->getParam('last_name');

    $endpoint = "/recipients";
    $data = array(
        "list_id" => $this->listId,
        "email" => $email,
        "gender" => $gender,
        "first_name" => $first_name,
        "last_name" => $last_name,
    );

    $response = $this->curl($endpoint, $data);

    var_dump($response);
}

/**
 * @param $endpoint string the endpoint to call (see docs.newsletter2go.com)
 * @param $data array tha data to submit. In case of POST and PATCH its submitted as the body of the …
Run Code Online (Sandbox Code Playgroud)

php api rest newsletter2go

4
推荐指数
1
解决办法
139
查看次数

Newsletter2Go - 使用javascript填写表格后无效?

我尝试使用客户数据自动填写newsletter2go表单.表单是使用javascript代码动态创建的,我是从newsletter2go后端获得的.

但我发现,如果我使用javascript填充它,表单将不再起作用了!?如果我手动填充它,它的工作原理非常好.

我从开发者控制台执行了这段代码:

    var inputEmail = document.getElementsByClassName("newsletterInput")[0],
        inputVorname = document.getElementsByClassName("newsletterInput")[1],
        inputNachname = document.getElementsByClassName("newsletterInput")[2],
        selectAnrede = document.getElementsByClassName("newsletterSelect")[0];

    if (inputEmail.value == "") {
        inputEmail.value = 'foo@bar.de';
    }

    if (selectAnrede.value == "") {
        selectAnrede.value = 'm';
    }

    if (inputVorname.value == "") {
        inputVorname.value = 'Edward';
    }
    if (inputNachname.value == "") {
        inputNachname.value = 'Black';
    }
Run Code Online (Sandbox Code Playgroud)

表格已经填满,但如果我提交,那么我会看到抱歉,发生了错误.请检查您的数据.

此时请求有效负载: 在此输入图像描述

为什么会失败?


如果浏览器自动填写表单,那么它的工作顺便说一句.

javascript newsletter newsletter2go

2
推荐指数
1
解决办法
45
查看次数

标签 统计

newsletter2go ×2

api ×1

javascript ×1

newsletter ×1

php ×1

rest ×1