SendInBlue 创建联系人错误

SendInBlue create contact error

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

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);

我有这个错误...

[400] Error connecting to the API (https://api.sendinblue.com/v3/contacts)

使用 github 文档

<?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;
}
?>