Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to set request body as attachment plus json payload to call API in servicenow

supriyanika
Tera Contributor

how we can set attachment and json body as request body in servicenow to call the api i tried below script but it it sending binary data and api is not accepting binary data

 
 

WhatsApp Image 2026-02-24 at 7.29.34 PM.jpeg

1 REPLY 1

yashkamde
Mega Sage

Hello @supriyanika ,

 

Try converting your JSON to string and then set to the request-body.

r.setRequestBody(JSON.stringify(body));

 

If my response helped mark as helpful and accept the solution.