CORS issue with sendgrid

Hello, I’m having an issue with sending a post request to sendgrid to use a template I have already created on sendgrid. I’m wondering if I’m missing something here or if there is any way you guys can help me understand the problem I’m facing a little bit more. I’ve removed the bearer token for security purposes from the screen shot.


Hi @CD_Engineers

Welcome to the Backendless community!

According to their docs they do not allow (CORS) API calls from web-based apps

To fix the issue you can do the following:

  • create an API Service
  • add an API Method to send requests to sendgrid
  • in the UI-Builder app run the API method instead of running a direct request to sendgrid

Regards,
Vlad

1 Like

Thank you so much for the reply! I figured that is where I had to do it from I’m just curious if you could send me to documentation for how to do that exactly? I tried creating a service but I can’t figure out how to change the endpoint to Sendgrid and not backendless.

I could be doing this completely wrong so let me know!

you are almost there

  1. once you created an API Method add the necessary parameters
  2. then in the method logic do whatever you need using these parameters, do not forget to deploy these changes
  3. and finally run the API method from the client app



You’re amazing!

1 Like