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

Yes I also think on similar line.


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

1last question. I have written a BR like this on update of record.



Any reason why would the BR show as 404 as HTTP status where the PUT method show 204


I am not able to paste my BR, it shows some error and dont allow to copy and paste here. But its same as Script Preview usage


And then the variables values have been substituted with current.number.



Can you help me what might be wrong?


Dave Smith1
ServiceNow Employee
ServiceNow Employee

surya soni wrote:



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?


You assume correctly: https://httpstatuses.com/204



204 is saying it's successful, but nothing has returned. 200 is successful with something returned (like an "okay" page, etc)



If you need 200, you'll need to configure the receiving API to return something.   I'd prefer to check for a 204 to say things are fine - generally I'd only expect content if (a) there's some error, or (b) the operation specifically requested content returned.


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?


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


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



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.


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.