- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 02:55 AM
Hey guys,
I want to modify a value in a record via JSON data modification API. I used the following link as shown in the product documentation (https://docs.servicenow.com/en-US/bundle/vancouver-api-reference/page/integrate/inbound-other-web-se...) :
I replaced myinstance.service-now.com with my instance URL. The expected result: Modification of the description field to the value 'test'.
But the result I received is: {"reason":null,"error":"Invalid sysparm_action: update:{\"description\":\"test\"}"}
When I remove the body and enter the following URL: https://dev112435.service-now.com/sc_request.do?JSONv2&sysparm_query=description=paris&sysparm_actio... I received the following error message: {"reason":null,"error":"json object is null"}
How should the body look like to get the expected result?
Thanks for your help guys
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 03:39 AM
you need to pass the json request body since it's POST method
This worked for me. Ensure the user you are using to test has valid write access to the table and field
the json key should be the field name which you want to update
1) Method - POST
2) Application type - application/json
Request
Output: the field got updated with value 10
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 03:39 AM
you need to pass the json request body since it's POST method
This worked for me. Ensure the user you are using to test has valid write access to the table and field
the json key should be the field name which you want to update
1) Method - POST
2) Application type - application/json
Request
Output: the field got updated with value 10
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:09 AM
Hey Ankur,
I tried to execute the script with the same tool and got an 401 (Unauthorized) error message, even though I'm logged in as system administrator.
Do you know whats the issue here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:16 AM
401 means incorrect username and password.
Please ensure you give correct credentials and that user has write access to record and field
I believe I have answered your query as I shared how the request should look like and the working output.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:10 AM
And thanks for your support.