Create a user-supplied variable for a Vultr Marketplace app using the Vultr Console or Vultr API to collect required values from customers before deployment.
A user-supplied variable requests information from a customer during deployment, such as a domain name or a preferred username. The Marketplace displays the variable in your application instructions and exposes its value to your application through the Vultr Metadata API.
This guide explains how to create a user-supplied variable using the Vultr Console or the Vultr API.
Click Marketplace in the Vultr Console's left-hand menu.
Click the application name to open the Edit App screen.
Click the Variables tab.
Under Add New Variable, enter the following information.
Under Input Type, select Text Field or Textarea for the kind of input customers enter.
Set the Is this field required to deploy this App? toggle to indicate whether the variable is required.
Click Add New Variable.
Verify that the new variable appears in the Variables list.
Send a POST request to the Create Marketplace App Variable endpoint. Replace {app-id} with the app's ID, and VARIABLE-NAME and VARIABLE-LABEL with your values. Set input_type to text_field or textarea.
$ curl "https://api.vultr.com/v2/marketplace/apps/{app-id}/manage-variables" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "VARIABLE-NAME",
"label": "VARIABLE-LABEL",
"type": "user_supplied",
"input_type": "text_field",
"input_required": true
}'
The response contains the new app_variable object, including its id.