Skip to content
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 400 while sending #211

Closed
luilver opened this issue Feb 10, 2021 · 1 comment
Closed

error 400 while sending #211

luilver opened this issue Feb 10, 2021 · 1 comment

Comments

@luilver
Copy link

luilver commented Feb 10, 2021

Hello,

I have an API using standalone, Grape or Sinatra controllers (not ActionController). I have properly included gem 'mailjet', bundled and configured my initializers/mailjet.rb as well (with my credentials).

Now when I perform the request to send email, I'm getting this error 400, which is described within docs as "One or more parameters are missing or maybe misspelled (unknown resource or action)."

api_1  | error 400 while sending #<RestClient::Resource:0x000055d85fb51ed0 @url="https://api.mailjet.com/v3/send", @block=nil, @options={:public_operations=>[:post], :read_only=>nil, :perform_api_call=>true, :open_timeout=>nil, :read_timeout=>nil, :user=>"MY_API_KEY", :password=>"MY_API_SECRET", :content_type=>"application/json"}> to https://api.mailjet.com/v3/send with {"Message"=>[{"From"=>{"Email"=>"MY_ACCOUNT_EMAIL", "Name"=>"Test"}, "To"=>[{"Email"=>"ANOTHER_EMAIL", "Name"=>"Another"}], "Subject"=>"Test 1", "TextPart"=>"Hello from me!", "HTMLPart"=>"<h3> Your verification code: 534517</h3>"}]}
api_1  | 
api_1  | "{}"
api_1  | 
api_1  | Please see https://dev.mailjet.com/guides/#status-codes for more informations on error numbers.

I have tried to use config.api_version = "v3.1" without success.

I have no idea what is wrong. I just did perform step by step as you described here.

What is wrong with my parameters?

@luilver
Copy link
Author

luilver commented Feb 12, 2021

I found it: My mistake was that :messages is in plural not singular.

@luilver luilver closed this as completed Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant