

#Splunk enterprise rest api code
This code contains the following methods: Under the hood, the setup page code uses the Splunk SDK for JavaScript to post the user’s password to the storage/passwords REST API endpoint, as shown in the following code snippet. This screenshot shows a setup page, from the Developer Tutorial app, that prompts the user to create a password to complete app setup. You can use a setup page to capture this information the first time that a user runs the app.

To store a secret in a Splunk app, you need to collect the associated name, password, and realm from the user. Store a Secret Using the Splunk SDK for JavaScript In this blog post, we’ll walk through an example that uses the Splunk SDK for JavaScript to store a secret and the Splunk Enterprise REST API to retrieve the secret. You can call the storage/passwords REST API endpoint to manage secret storage using the following methods: Three Ways to Manage Secret Storage in a Splunk App See Configure access control for secret storage. Note: Users require specific capabilities to store and retrieve secrets in an app.
#Splunk enterprise rest api how to
This diagram shows the workflow for how to store and retrieve secrets in an app using the storage/passwords endpoint:

This API call returns the clear text, encrypted, and masked forms of the password associated with a user's credentials. To retrieve a secret from the nf file, submit a GET request to the storage/passwords endpoint. Then, call the storage/passwords endpoint to encrypt the secret and save this information in the nf file. To store a secret in an app, you first need to collect the associated name, password, and realm using a setup page. Authorized users can then retrieve and use the secret for authentication. When you store a secret in a Splunk app, the Splunk platform encrypts the secret and stores this information in the nf file. You can have multiple secrets for the same user if the realm is different.
