JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Passing parameters to sendgrid

Hi there,

I have setup (using the tutorial) the standard Sendgrid api and it works fine when I enter values directly into the service using the request tab. I have it setup with secure proxy.

I am however having problems sending when I use service execute command.

Can you please advise where I am going wrong:

Test.execute({"data": {"api_user": "{api_user_proxy}", "api_key": "{api_key_proxy}","to":"a href="mailto:Name1@gmail.com" rel="nofollow"Name1@gmail.com/a","from":"a href="mailto:Name2@gmail.com" rel="nofollow"Name2@gmail.com/a","subject":"Test email"}});

where SendGrid is the name of my service

It appears to be failing on the POST (400 bad request). I get the following error:

errors: ["Missing destination email"], message: "error"}
errors: ["Missing destination email"]
message: "error"

your help would be much appreciated.

THanks
James

the request payload looks like this
api_user=%7Bapi_user_proxy%7D&api_key=%7Bapi_key_proxy%7D&to=james.holman00%40gmail.com&from=james.holman00%40gmail.com&subject=Test+email

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Passing parameters to sendgrid

Hello Jimmy,

You send {api_user_proxy} as a string. Please change it into current value. Service Settings don't apply when you execute service from the JS

JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Passing parameters to sendgrid

Hi Sergiy,

I have changed both the api_user_proxy and the api_key to strings (ie the Sendgrid username and api key) and it still does not work and I still get the same error ie POST (400 bad request). I get the following error:

errors: ["Missing destination email"], message: "error"}
errors: ["Missing destination email"]
message: "error"

If you enter both the api_user_proxy and the api_key as strings, doesn't it mean that these values will be visible in the javascript which is not secure?.

thanks
james

JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Passing parameters to sendgrid

this is what my script looks like:

Test.execute({"data": {"api_user": "UserName", "api_key": "APIKEY","to":"a href="mailto:somebody@gmail.com" rel="nofollow"somebody@gmail.com/a","from":"a href="mailto:somebody@gmail.com" rel="nofollow"somebody@gmail.com/a","subject":"Test email"}});

where UserName and APIKEY is the string from SendGrid details.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Passing parameters to sendgrid

Please share (http://devcenter.appery.io/documentat...) your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and provide us with the following information:

1) App name
2) Test credentials if login functionality is implemented in your app
3) Detailed steps to reproduce the issue

Return to “Issues”