Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

getting 500 Internal Server error for Email API using Rest API Explorer

Manish Kumar S1
Kilo Contributor

HI Team,

I am getting 500 Internal Server error while sending Email API through Rest API explorer. Can you please let me know that Am I missing any configuration changes or any setting needs to enable or header related input at the time of calling Post Email API ?

find_real_file.png

 

find_real_file.png

Raw output:- 

{
  "error": {
    "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@ba2498; line: 1, column: 2] (through reference chain: com.glide.email.service.Email[\"to\"])",
    "detail": "Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: com.glide.size_aware.SizeAwareServletInputStream@ba2498; 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"
  },
  "status": "failure"
}

Regards,
Manish
1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

Use beloe JSON payload to use Email API 

 

{

 "to": [

 "josh.nee@servicenow.com",

"dave.slusherwt@servicenow.com"

],

 "subject": "Test from the new Email API!",

 "text": "This is pretty cool stuff",

 "table_name": "incident",

 "table_record_id": "d71f7935c0a8016700802b64c67c11c6"

}

 

 

Regards,

Sachin

View solution in original post

2 REPLIES 2

sachin_namjoshi
Kilo Patron
Kilo Patron

Use beloe JSON payload to use Email API 

 

{

 "to": [

 "josh.nee@servicenow.com",

"dave.slusherwt@servicenow.com"

],

 "subject": "Test from the new Email API!",

 "text": "This is pretty cool stuff",

 "table_name": "incident",

 "table_record_id": "d71f7935c0a8016700802b64c67c11c6"

}

 

 

Regards,

Sachin

Hi Sachin,

 

Thanks for your quick response and help. The above shared JSON code is working fine with Rest API explorer and also I modified above JSON code tested with my GMAIL account then I got 200 OK successful response as well as received email. I have shared the below output for other people reference purpose.

find_real_file.png

 

Regards,

Manish