sendinblue创建联系错误



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

SwaggerClientConfiguration::getDefaultConfiguration()->setApiKey('api-key', env('SENDINBLUE_API_KEY'));
$api_instance = new SwaggerClientApiContactsApi();
$createContact = new SwaggerClientModelCreateContact();
$createContact['email'] = 'email@gmail.com';
$createContact['listIds'] = 2;
$result = $api_instance->createContact($createContact);
dd($result);

我有这个错误...

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

使用github docs

<?php
require_once(DIR . 'autoload.php');
// Configure API key authorization: api-key
SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
$api_instance = new SendinBlueClientApiContactsApi();
$createContact = new SendinBlueClientModelCreateContact(); // SendinBlueClientModelCreateContact | 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;
}
?>

相关内容

  • 没有找到相关文章

最新更新