diff --git a/Server-Side Components/Background Scripts/RetrieveAPIKey/Readme.md b/Server-Side Components/Background Scripts/RetrieveAPIKey/Readme.md new file mode 100644 index 0000000000..1557a1280d --- /dev/null +++ b/Server-Side Components/Background Scripts/RetrieveAPIKey/Readme.md @@ -0,0 +1,3 @@ +This BG script will be helpful to fetch the subscription key for any API to view key value if forget, store and update if required for doc purpose + +This will use GlideEncrypter and Decrypter API. diff --git a/Server-Side Components/Background Scripts/RetrieveAPIKey/getSubscriptionKey.js b/Server-Side Components/Background Scripts/RetrieveAPIKey/getSubscriptionKey.js new file mode 100644 index 0000000000..5a43d568ef --- /dev/null +++ b/Server-Side Components/Background Scripts/RetrieveAPIKey/getSubscriptionKey.js @@ -0,0 +1,13 @@ +/* +This BG script will be helpful to fetch the subscription key for any API to view key value if forget, store and update if required for doc purpose + +This will use GlideEncrypter and Decrypter API +*/ +var gr = new GlideRecord('api_key_credentials'); + gr.addQuery('name', ' '); // Replace with your credential name + gr.query(); + if (gr.next()) { + var encryptedApiKey = gr.api_key; // Assuming 'api_key' is the field name + var decryptedApiKey = new GlideEncrypter().decrypt(encryptedApiKey); + gs.info("Decrypted API Key: " + decryptedApiKey); + }