Post comments to requested item using curl

knchaitanya9
Tera Contributor

Hello

I would like to post comments to existing Requested Items (RITM), I'm using the curl script below to post comments on a particular RITM and it's not working and throwing errors, can anyone tell me what was wrong with my curl command


CURL COMMAND:
curl -X POST "https://<INSTANCE URL>/api/now/table/sc_req_item" -H "Authorization: Basic <TOKEN>" -H 'Content-Type: application/json' -d '{\"comments\":\"STATUS IS COMPLETED, PLEASE VALIDATE\",\"requested_item\":\"RITM789124\"}'


ERROR:

 

{"error":{"message":"Exception while reading request","detail":"The payload is not valid JSON."},"status":"failure"}

1 ACCEPTED SOLUTION

@knchaitanya9  This is an example of PUT API to update comment using curl, make changes based on your need. 

 

 

 

curl "https://<YourInstanceID>.service-now.com/api/now/table/sc_req_item/0495fdf11bfbb9507514415dee4bcb5c" \
--request PUT \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{\"comments\":\"Adding Test Comment\"}" \
--user 'USERID':'YourPassword'

 

 

 

Hope it will help you. 

 

Thanks,

Harsh

View solution in original post

5 REPLIES 5

Yup, Thanks for showing the the path, I will try it now