-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error code 400: "Bad Request" when adding custom arguments as Integer values #350
Comments
Thanks for taking the time to report this issue @igorokb. I've added this to our backlog so that we will always encode that parameter correctly behind the scenes. |
It seems to me to have the same bug, is there a workaround ? foreach($substitions as $var => $val) { |
Can you please post your payload? $json_string = json_encode($mail, JSON_PRETTY_PRINT);
echo $json_string; Thanks! |
+1 ran into the same issue compared to your example code (https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), this works for me: |
Same thing started happening for me earlier this year on python... Ended up changing |
This has been moved here. |
Issue Summary
The following response is received when trying to add a numeric custom parameter:
JSON encoded request data looks as below:
As shown above, json_encode doesn't quotes number properties. Thus
111
is sent as number.However if the parameter is casted to (string) type, the email is sent successfully.
Steps to Reproduce
Personalization::addCustomArg()
of thePersonalization
instance linked to theMail
Technical details:
PHP 5.6.29 and 7.0.13
SendGrid 5.1.2
The text was updated successfully, but these errors were encountered: