"The Public Key is required." #33
-
Hi. I'm trying to use the API endpoint to send a request and keep receiving a
I am providing a valid I'm currently testing this in Postman. Any help would be greatly appreciated! Fetch Request Sample Codevar myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.emailjs.com/api/v1.0/email/send?service_id=gmail_service&template_id=default_template&user_id=XXXXXX&template_params[to_name]=Jane Doe&template_params[from_name]=John Doe&template_params[from_email][email protected]&template_params[reply_to][email protected]&template_params[from_message]=Hello. I am John Doe.", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error)); Postman Collection JSON{
"info": {
"_postman_id": "703c9644-45ad-417d-add5-073f67759cc8",
"name": "EmailJS Postman Collection Test",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Send Email",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "https://api.emailjs.com/api/v1.0/email/send?service_id=gmail_service&template_id=default_template&user_id=XXXXXX&template_params[to_name]=Jane Doe&template_params[from_name]=John Doe&template_params[from_email][email protected]&template_params[reply_to][email protected]&template_params[from_message]=Hello. I am John Doe.",
"protocol": "https",
"host": [
"api",
"emailjs",
"com"
],
"path": [
"api",
"v1.0",
"email",
"send"
],
"query": [
{
"key": "service_id",
"value": "gmail_service"
},
{
"key": "template_id",
"value": "default_template"
},
{
"key": "user_id",
"value": "XXXXXX"
},
{
"key": "template_params[to_name]",
"value": "Jane Doe"
},
{
"key": "template_params[from_name]",
"value": "John Doe"
},
{
"key": "template_params[from_email]",
"value": "[email protected]"
},
{
"key": "template_params[reply_to]",
"value": "[email protected]"
},
{
"key": "template_params[from_message]",
"value": "Hello. I am John Doe."
}
]
}
},
"response": []
}
]
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The params have to be in the body in JSON format instead of query params. |
Beta Was this translation helpful? Give feedback.
-
Still same error:
But I have resolved the issue.
Thank you very much! |
Beta Was this translation helpful? Give feedback.
Still same error: