Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not able to resolve incident using restapi

rajesh_solanki
Kilo Explorer

Hi ,

I m trying to resolve an incident using restapi. This is what I have done.

1) via rest api I have populated every field it needs for resolving an incident. (in my pay load I m not settings State : 6 . I have another request for resolving incident)

2) At this moment I can go in SNOW url , open my incident and if I click resolve button , incident goes in resolved state.

3) if I do step 1 again and then submit another rest api pay load which ONLY has {"state":6} it should move incident in Resolved state right ? even though I get error 200 in my response , I still do not see ticket in resolved state

4) why the State field is not updating when using RestAPI ?

what am I missing ?

23 REPLIES 23

find_real_file.png



find_real_file.png


treycarroll
Giga Guru

Hi Rajesh,



A couple of quick thoughts:



Why are you using PUT and not POST?   I'd bet that POST would work.



If your scripted REST API endpoint is in a scoped application then you will need to go to the dictionary entry to permit it to be updated from outside the global scope.



Regards,



Trey Carroll


i get following for post.



{


  "error": {


      "message": "Method not Supported",


      "detail": "POST method not supported for API"


  },


  "status": "failure"


}


This error message occurs when you don't pass sys_id of the record in the URL for PUT method.


you are forgetting that   **all other fields are getting updated ** except State.




find_real_file.png



of course without passing sysid i wont be able to GET.