getSmtpTemplates need string `true` to work
need to set as parameter 1 or 0 instead true / false as string in GET.
WORK with templateStatus=true
https://api.sendinblue.com/v3/smtp/templates?templateStatus=true&limit=50&offset=0
DONT WORK with templateStatus=1
https://api.sendinblue.com/v3/smtp/templates?templateStatus=1&limit=50&offset=0
Same issue here
Exception when calling SMTPApi->getSmtpTemplates: [400] Client error: GET https://api.sendinblue.com/v3/smtp/templates?templateStatus=1&limit=50&offset=0resulted in a400 Bad Request response: {"code":"invalid_parameter","message":"Template status should be either true or false"}
It's look like:
ObjectSerializer::toQueryValue($templateStatus);
is causing the problem because is casting the boolean to string.
Hi @giak
The API expects template status to be a boolean value.
Please set the templateStatus to true instead of 1.
The issue here is located in the PHP API, not @giak code: ->getSmtpTemplates( true, 500 ) results in:
[400] Client error: `GET https://api.sendinblue.com/v3/smtp/templates?templateStatus=1&limit=500&offset=0&sort=desc` resulted in a `400 Bad Request` response:\n
{"code":"invalid_parameter","message":"Template status should be either true or false"}\n
""",
@Spensolin is right, the ObjectSerializer::toQueryValue($templateStatus) call is probably in cause here.
FYI https://github.com/swagger-api/swagger-codegen/issues/10939 https://github.com/guzzle/psr7/issues/264
Hi, as a workaround you could pass "true" with quotes and even is not a logic solution (because its a string, not a bool) code is working.
Example:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// ...
// ...
$templateStatus = "true"; //<--- "true" (string) and not true (bool)
$limit = 50;
$offset = 0;
$sort = "desc";
try {
$result = $apiInstance->getSmtpTemplates($templateStatus, $limit, $offset, $sort);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TransactionalEmailsApi->getSmtpTemplates: ', $e->getMessage(), PHP_EOL;
}
?>
The DocBlock is incorrect, it says that it expects a boolean, however that will not work, so this should be a string. This is the right change to fix this:
- * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional)
+ * @param string $templateStatus Filter on the status of the template. Active = true, inactive = false (optional)
Or as an alternative, booleans should be converted to true and false instead of 1 and 0 when used in query strings. In that case, a change in the method ObjectSerializer::toString() could solve this.
This is still an issue today.