How to insert, update or retrieve encrypted data via REST API

snowuser111
Kilo Guru

Hello Guys,

Need help please.

We have encrypted certain fields in our instance (only field level encryption via encryption context)

Now when I test it and retrieve the data via any REST API client, i cant see original value of that field instead see some encrypted value. But User must be able to view his queried issue and able to submit the issues.

So how do I handle this. Please help. example I ran the GET method to retrieve a record but i don't see original value. even though I have proper role.

find_real_file.png

Thanks

2 REPLIES 2

Manjeet Singh
ServiceNow Employee
ServiceNow Employee

Hi,



Are you using EDGE Encryption: Edge Encryption ?



Or you are doing it using some custom scripting?


Tom Charly
ServiceNow Employee
ServiceNow Employee

This is an OOB Behavior!

Suggested Workaround :


***GET*** 
- For retrieving records from the table that has an encrypted text field as a user WITH the necessary encryption context, send query parameter (sysparm_display_value=true) in request 
http://INSTANCENAME.service-now.com/api/now/table/tab1?sysparm_display_value=true 

***POST*** 
- For creating records with user that HAS the necessary encryption context, send query parameter (sysparm_input_display_value=true) in request 
http://INSTANCENAME.service-now.com/api/now/table/tab1?sysparm_input_display_value=true 
{"c1":"e25","password":"password25"} where password is encrypted text field"