The CreatorCon Call for Content is officially open! Get started here.

REST API

surya123
Mega Guru

Hi All,

We need to send the update to the third party system when a record is updated in Servicenow.

I created a PUT method. But I see a http status as 204 instead of 200.Becuase of this i asssume i see a blank response body. How can i get it as 200?

1 ACCEPTED SOLUTION

Dave Smith1
ServiceNow Employee
ServiceNow Employee

surya soni wrote:



Hi Dave


Is it fine to have the status as 204 ? But if the response body is not having any data,, How will it update the third party system with the data change in the SNOW?


The response is the third party letting you know everything's okay - it should have performed the update/action as you requested.   Essentially, you've put a letter into the postbox successfully - the postbox hasn't printed off a receipt to show you it's been received.


whn i copy the script from the PUT method and use it in BR, i see a status code as 404 instead of 204.


404 is "page not found".   So presumably there's some error.   Did you check the weblogs on the third party to see what caused it?


Is there something I need to do, so I can update the 3rd party system when any value changes in SNOW?


You keep mentioning data you're sending to the third party... are you yet to check this third party to see if it's worked at all?   You're posting letters, asking the postbox why the recipient hasn't received them... why not ask the recipient directly?


I am getting a GET response from 3rd party system which I am using from creating rec in SNOW. Nw when those recods are updated I want to update the record in 3rd party system aswell.


Which presumably is the purpose of your exercise here.   But you don't seem to be checking the 3rd party for success at all.   As I mentioned above:


        If you need 200, you'll need to configure the receiving API to return something.


- meaning you'll need to get the API documentation for the third party and work out how it can return a response indicating success/failure.


View solution in original post

16 REPLIES 16

Jaspal Singh
Mega Patron
Mega Patron

Could you kindly help with the REST API snippet being passed.


Hi,


REST API SNippet as in the PUT method which i configured?


Hi Surya,



Can you share the code present in scripted rest?


Also are you sending any response back in the scripted rest api?



Regards


Ankur


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

No I am not sending anything.


I just created a PUT Method from the notepad I pasted.


I added the content and variable substitutes. I got 204.


Now if i dont get a response, will any update in SNOW, also update the   3rd party?