我正在尝试一个GET请求,以获取带有Guzzle HTTP的email\u令牌,如下所示:
$email = $customer['attributes']['Email'];
$client = new Client();
$res = $client->request('GET', 'https://www.example.com/apps/api/Services/Email/Opting', [
'email' => $email
]);
dd($res->getBody());
回复返回200/OK,但我没有收到预期的email\u令牌。我正在编写的稀疏API文档给出了一个非常类似的示例,并指出预期响应的内容应该如下所示:
{
"email": "test@example.com",
"marketing": true,
"promotional": true,
"news": true,
"feedback": true,
"account_related": true,
"token": "eyJpdiI6Ik9tNlFwbEorbjNnK1FsNnFZb1ZtaFE9PSIsInZhbHVlIjoibGNheWpDR0Z6eWpcL1VCbjdsUXZCS0lzRURBZTIzMVc5ZXRTamQrd1dQTFE9IiwibWFjIjoiYTEwYTM2ODU0MmQzMTY5NGIwNWFhOWFjM2ZiZTBkMzkzOWMyY2VkYTMzNjk5ZDYyOTE0OGY2YjBhNGNkYjk4NyJ9"
}
一旦我得到了令牌,我就需要发表一篇带有更多要求的帖子(其中一个是email\u令牌),以便使客户能够自动退出邮件列表。你有没有想过为什么我的反应会这样?
Screenshot of dd($res);
Screenshot of dd($res->getBody());