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_addressRequiredstring
Stacks address
contract_nameRequiredstring
Contract name
data_varRequiredstring
Data variable name
Query Parameters
proofstring
When supplied 0, will return the JSON object without the proof field.
| Status code | Description | 
|---|---|
| 200 | Success | 
| 400 | 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",}