How does Scripted REST API PATCH Work

arwinblones
Tera Contributor

Hi,

Im currently implementing an integration between my instances but im currently lost in the scripted rest api within PUT and PATCH resource.

the error response always is this in PATCH

REST Msg Outbound - RESTMessageClient : Error executing REST request: Invalid uri 'https://dev204xxx.service-now.com/api/18xxx7x/ebonding_inbound_api/update_incident/{sys_id}': escaped absolute path not valid: Invalid uri 'https://dev204xxx.service-now.com/api/18xxx7x/ebonding_inbound_api/update_incident/{sys_id}': escaped absolute path not valid: no thrown error

but my POST resource it succeeded on my end without an error

arwinblones_0-1765779391967.png

 

9 REPLIES 9

@Ankur Bawiskar 

tried that but undefined when json request i used

@arwinblones 

share what request body you are sending and how you are grabbing it?

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

So I don't think the structure in explorer will work (it will need the ${sys_id} then the target URL from the source will look like this ..../update_incident/12342sys1232id12312312 whatever the sys_id of the inc is), but we'll get there. Can you provide how you're encoding the data in the source instance?

It looks like you've got the screen captures for the inbound configuration but we'll need to know what you're trying to send to make sure the parameters being passed are being done correctly.

Corey19
Tera Expert

FYI heres a video someone's made with a similar intent as to what you're working on:
https://www.youtube.com/watch?v=35I_1_V1SnQ

Might have something that can help too 😊

This video implements a PATCH resource for modifying records in ServiceNow. It also discusses the difference between PUT and PATCH, and how these relate to the GlideRecord.update() method. Scripts in this series are located in my GitHub repo: https://github.com/Jay-Cool/Vehicles-API-Files Further

@Corey19 , okay will try this one on my end and ill update once it works.