This endpoint represents a single data associated with a given account.
Request
GET /accounts/{account}/data/{key}
Arguments
name |
notes |
description |
example |
key |
required, string |
Key name |
user-id |
curl Example Request
curl "https://horizon-testnet.stellar.org/accounts/GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36/data/user-id"
JavaScript Example Request
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
server.accounts()
.accountId("GAKLBGHNHFQ3BMUYG5KU4BEWO6EYQHZHAXEWC33W34PH2RBHZDSQBD75")
.call()
.then(function (account) {
return account.data({key: 'user-id'})
})
.then(function(dataValue) {
console.log(dataValue)
})
.catch(function (err) {
console.log(err)
})
Response
This endpoint responds with a value of the data field for the given account. See data resource for reference.
Example Response
{
"value": "MTAw"
}
Possible Errors
- The standard errors.
- not_found: A
not_found
error will be returned if there is no account whose ID matches the account
argument or there is no data field with a given key.
Edit this doc in GitHub