Pulling wallet (and other) profile data from steemit.com/@username.json using javascript
Did you know that steemit.com's front-end (condenser) serves profile data for use in other applications via JSON? Check it out, example: steemit.com/@username.json. Just fill in your username and go.
SBD, STEEM, and VESTS balances are available in addition to quite a bit more.
steemit.com serves content in gzip compressed format, so you do need to load a library and pipe it in order to get valid JSON - easy enough.
I'm sure some of you will find this useful :)
This is an example and it just displays a few objects, but it's as simple as this:
const https = require('https');
const zlib = require('zlib');
let options = {
host: 'steemit.com',
path: '/@username.json'
};
https.get(options, function (res) {
let json = '';
let gunzip = zlib.createGunzip();
res.pipe(gunzip);
gunzip.on('data', function (chunk) {
json += chunk;
});
gunzip.on('end', function () {
if (res.statusCode === 200) {
try {
let data = JSON.parse(json);
console.log('STEEM balance: ' + data.user.balance);
console.log('SBD balance: ' + data.user.sbd_balance);
console.log('VEST balance: ' + data.user.vesting_shares);
} catch (e) {
console.log('Error parsing JSON');
}
} else {
console.log('Non-200 status code received: ' + res.statusCode);
}
}).on('error', function (err) {
console.log('Error pulling JSON: ' + err);
});
});
Enjoy and Steem On!
Leave Pulling wallet (and other) profile data from steemit.com/@username.json using javascript to:
Read more #steemdev posts
Best Posts From Justin Welch
We have not curated any of justinw's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Justin Welch
- Koinos and Hive: What's the difference and why?
- Open Sourcing Goodvoter - My Old Vote Trail Following Bot
- The real reason altcoins are behaving differently in this bear market?
- I'm no longer at Steemit Inc.
- My Background and Vision for Steem
- How easy it is to develop STEEM blockchain apps - with video tutorial!
- Updated instructions for running condenser and a PR in to update the README
- One of my favorite secret spots for hiking on the planet
- The market cap of all coins has DOUBLED in just a month - and keeps climbing
- Pulling wallet (and other) profile data from steemit.com/@username.json using javascript
- Using EC2 Instance Store (SSD) with Amazon Elastic Beanstalk and Docker
- Using an NGINX reverse proxy behind an ELB in AWS
- An invitation to test-drive the latest features coming to steemit.com
- It snowed in the mountains of WNC and our snowdogs had a great time!