How to extract data from a multipart/form-data body in a Scripted REST API to attach a file

snow01
Tera Contributor

I am configuring a scripted REST API to attach a file from another instance to ServiceNow. The other interface sends me the data in the request body as multipart/form-data, but I am unable to retrieve the different pieces of data from the body.
Do you have any idea how I can achieve this?

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@snow01 

these links should help you and it will require custom logic

Inbound Multipart/form-data via the Scripted REST API (in a scoped application) 

Handling 'text/plain' and Other Unsupported Content Types in ServiceNow Scripted REST APIs  

Git hub link 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader