How to Send email using Email REST API
This content was last updated in 2018. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2018 02:06 AM
Hi Guys,
I tried to Send an email from EMAIL REST API. I got the below error message. Here is my Request format
Accept:application/json
Content-Type: application/json
{"to":"malaravan@example.com","cc":"phil.hendrie@example.com","subject":"Testing for rest email ","text":"Testing for restemail","table_name":"incident","table_record_id":"61ee027b0f305380ac4c4d9ce1050e6a","bcc":"user5@example.com"}
The Error which i received below.
{
"error": {
"detail": "Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: com.glide.size_aware.SizeAwareServletInputStream@74acfe; line: 1, column: 2] (through reference chain: com.glide.email.service.Email[\"to\"]) Check logs for error trace or enable glide.rest.debug property to verify REST request processing",
"message": "org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: com.glide.size_aware.SizeAwareServletInputStream@74acfe; line: 1, column: 2] (through reference chain: com.glide.email.service.Email[\"to\"])"
},
"status": "failure"
}
Please let me know what is missing here.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2018 02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2018 09:31 AM
Did you ever figure this out? the documentation linked previously doesn't seem to help. I've had the same error message, and can't figure out why.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 09:01 PM
Hi,
Hopefully, this is the blog which you are looking for.
https://developer.servicenow.com/blog.do?p=/post/whats-new-for-developers-in-istanbul---integrations-apis-authentication/
Regards,
Aakash Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2018 06:02 AM
you should construct your rest message properly. Below rest body works well for me.
{
"to": [
"josh.nee@servicenow.com",
"dave.slusherwt@servicenow.com"
],
"subject": "Test from the new Istanbul Email API!",
"text": "This is pretty cool stuff",
"table_name": "incident",
"table_record_id": "d71f7935c0a8016700802b64c67c11c6"
}
Thanks,
sun_malar