Php 新闻稿2GO REST API-如何向列表中添加新收件人?
是否可以通过Newslette2go的REST API添加新收件人 我这样试过(片段): 但是我得到了一个很大的响应对象,即使我只尝试添加一个收件人,而新的收件人没有添加到列表中Php 新闻稿2GO REST API-如何向列表中添加新收件人?,php,rest,api,newsletter2go,Php,Rest,Api,Newsletter2go,是否可以通过Newslette2go的REST API添加新收件人 我这样试过(片段): 但是我得到了一个很大的响应对象,即使我只尝试添加一个收件人,而新的收件人没有添加到列表中 object(stdClass)#188 (3) { ["status"]=> int(200) ["info"]=> object(stdClass)#169 (3) { ["links"]=> object(stdClass)#43 (3) { ["_
object(stdClass)#188 (3) {
["status"]=>
int(200)
["info"]=>
object(stdClass)#169 (3) {
["links"]=>
object(stdClass)#43 (3) {
["_href"]=>
string(60) "https://api.newsletter2go.com/recipients?_limit=50&_offset=0"
["_next"]=>
string(61) "https://api.newsletter2go.com/recipients?_limit=50&_offset=50"
["_last"]=>
string(63) "https://api.newsletter2go.com/recipients?_limit=50&_offset=3433"
}
["count"]=>
int(3483)
["additional"]=>
object(stdClass)#167 (1) {
["active"]=>
int(0)
}
}
["value"]=>
array(50) {
[0]=>
object(stdClass)#85 (2) {
["_href"]=>
string(49) "https://api.newsletter2go.com/recipients/n9yldrar"
["id"]=>
string(8) "n9yldrar"
}
[1]=>
object(stdClass)#185 (2) {
["_href"]=>
string(49) "https://api.newsletter2go.com/recipients/pgwvgwmr"
["id"]=>
string(8) "pgwvgwmr"
}
...
[49]=>
object(stdClass)#87 (2) {
["_href"]=>
string(49) "https://api.newsletter2go.com/recipients/usa0dx4n"
["id"]=>
string(8) "usa0dx4n"
}
您必须使用POST请求添加收件人,此时您正在发出GET请求。改变
$response = $this->curl($endpoint, $data);
到
那它就应该起作用了
大多数GET请求用于获取数据,而POST请求用于设置数据。您发布的GET请求将返回所有收件人
$response = $this->curl($endpoint, $data);
$response = $this->curl($endpoint, $data, 'POST');