Get data variable value
Get the value of a data variable inside a contract.
GET
/v2/constant_val/{contract_address}/{contract_name}/{data_var}
Get the value of a data variable inside a contract
Attempt to vetch a data var from a contract. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The variable is identified with [Var Name].
In the response, data
is the hex serialization of the data variable value.
Path Parameters
contract_address
Requiredstring
Stacks address
contract_name
Requiredstring
Contract name
data_var
Requiredstring
Data variable name
Query Parameters
proof
string
When supplied 0
, will return the JSON object without the proof
field.
Status code | Description |
---|---|
| Success |
| Failed to retrieve data variable value from contract |
Terminal
$curl -X GET "http://localhost:20443/v2/data_var/string/string/string"
Response of get constant val request
{"data": "string","proof": "string",}