首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SendInBlue创建接触错误

SendInBlue创建接触错误
EN

Stack Overflow用户
提问于 2017-09-10 09:52:23
回答 1查看 2.1K关注 0票数 0

我在本地工作,以测试SendInBlue创建联系人。

代码语言:javascript
复制
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', env('SENDINBLUE_API_KEY'));

$api_instance = new Swagger\Client\Api\ContactsApi();
$createContact = new Swagger\Client\Model\CreateContact();

$createContact['email'] = 'email@gmail.com';
$createContact['listIds'] = 2;

$result = $api_instance->createContact($createContact);

dd($result);

我有个错误..。

连接到API (https://api.sendinblue.com/v3/contacts)的400个错误

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-11 12:10:07

使用github文档

代码语言:javascript
复制
<?php

require_once(DIR . 'autoload.php');

// Configure API key authorization: api-key
SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');

$api_instance = new SendinBlue\Client\Api\ContactsApi();
$createContact = new \SendinBlue\Client\Model\CreateContact(); // \SendinBlue\Client\Model\CreateContact | Values to create a contact

$createContact['email'] = 'email@gmails.com';


try {
    $result = $api_instance->createContact($createContact);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL;
}
?>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46139380

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档